Why does Firefox select a latin encoding for local UTF8 encoded XHTML-files
Firefox displays local XHTML files always first in latin encoding, even though - default encoding (config option intl.charset.default) is UTF-8 - the file starts with the header '' - no other encoding is mentioned in the file or in the referred CSS style sheet - the current locale is de_DE.UTF-8.
I am able to change the encoding via the menu, but I have to repeat this each time I open a file.
The files in questions are all simple XHTML files with no script elements and are opened with Ctrl-O.
所有回覆 (2)
You may have to save the file with the proper BOM code for UTF-8 to make this work.
Yes and No.
If I use a BOM Firefox recognizes the encoding, but displays the BOM at the top of the page! So there seems to be no way to get a standard conforming file to be displayed correctly.
It is really sick to base the recognition of UTF-8 on a BOM. According to the Unicode standard in UTF-8 a BOM is allowed but not necessary and discouraged. On the official web page http://unicode.org/faq/utf_bom.html they write "Where the precise type of the data stream is known... the BOM should not be used." And here we have XHTML which by default is, like any XML, encoded in UTF-8, and which explicitly is declared to be UTF-8 on a system whose locale is UTF-8 and where Firefox has been told to use UTF-8 in case of doubt -- and Firefox displays the file as Latin-1! ( Probably I should be happy that it didn't choose some Chinese encoding )-: , which is as reasonable as choosing Latin-1 as soon as you have gotten the western blinkers off.)