為了改善您的使用體驗,本網站正在進行維護,部分功能暫時無法使用。若本站的文件無法解決您的問題,想要向社群發問的話,請到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 發問,我們的社群成員將很快會回覆您的疑問。

搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

了解更多

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