An HTML file saved as Unicode, can't read in a CSS that isn't saved as Unicode.




9 years ago
9 years ago


(Reporter: Robert Hess, Unassigned)


Firefox Tracking Flags

(Not tracked)





9 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv: Gecko/20090715 Firefox/3.5.1 (.NET CLR 4.0.20506)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv: Gecko/20090715 Firefox/3.5.1 (.NET CLR 4.0.20506)

I was working on a website for a friend who owns a Chinese restaurant. I started noticing that some of the pages were acting as though the "link"ed css file wasn't being read in. I tracked it down to the HTML file having been saved out as unicode, but the css wasn't.

I had to insert some chinese characters into the CSS to force Visual Studio to prompt me to save the file out as Unicode, then remove the chinese.

Here is an example where the HTML is unicode, but the css isn't:

Here is and example where both the HTML and CSS are unicode:


Reproducible: Always

Steps to Reproduce:
1. Create an HTML file which uses a Link'ed CSS file.
2. Save the HTML file out as unicode but the css as non-unicode
3. View the web page and notice that the CSS didn't come in.
Actual Results:  
The web page doesn't utilize any of the styles defined in the CSS

Expected Results:  
I expected the web page to use the styles in the CSS

It might be a "little" more complex then that. I copied the files locally to my machine:
1. The HTML which was marked as Unicode
2. A CSS file not marked as Unicode
3. A CSS file which was marked as Unicode (identical to #2)

If the HTML referenced #2 it looked bad, if it referenced #3 it looked fine.
However if I opened up the non-unicode CSS file in Notepad, and then did a "Save As" to make it a Unicode file... it STILL didn't work. So I'm not sure how the local Win7 file system is marking a unicode file differently then Visual Studio is to an FTP'd location.
>When a style sheet resides in a separate file, user agents must observe the 
>following priorities when determining a style sheet's character encoding (from 
>highest priority to lowest): 
>   1. An HTTP "charset" parameter in a "Content-Type" field (or similar parameters in other protocols)
>   2. BOM and/or @charset (see below)
>   3. <link charset=""> or other metadata from the linking mechanism (if any)
>   4. charset of referring style sheet or document (if any)
>   5. Assume UTF-8

Your server doesn't send a charset header (1), you don't have a @charset rule or BOM in your css (2), (3) doesn't apply here and (3) is used or (4) = not a bug.

NTFS doesn't mar the used charset in a text document.
Your case with saving could be a caching issue, don't know.

marking invalid
Last Resolved: 9 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.