为提升您的使用体验,本站正在维护,部分功能暂时无法使用。如果本站文章无法解决您的问题,您想要向社区提问的话,请到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 提问,我们的支持社区将会很快回复您的疑问。

搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

Why does Firefox select a latin encoding for local UTF8 encoded XHTML-files

  • 2 个回答
  • 12 人有此问题
  • 7 次查看
  • 最后回复者为 drickes

more options

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.

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 '<?xml version="1.0" encoding="utf-8"?>' - 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)

more options

You may have to save the file with the proper BOM code for UTF-8 to make this work.

more options

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.)