This site will have limited functionality while we undergo maintenance to improve your experience. If an article doesn't solve your issue and you want to ask a question, we have our support community waiting to help you at @FirefoxSupport on Twitter and/r/firefox on Reddit.

Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

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

  • 2 replies
  • 12 have this problem
  • 7 views
  • Last reply by 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.

All Replies (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.)