Summarized test results:
Character encoding (XHTML5)

Intended audience: users, XHTML/HTML coders (using editors or scripting), script developers (PHP, JSP, etc.), CSS coders, Web project managers, and anyone who wants to know how selectors work in current browsers.

Updated

These tests check whether user agents recognise character encoding declarations for XHTML5 documents in the precedence order defined by the specification. These tests pages have XML syntax and are served as application/text+xhtml.

Note that the snapshot summaries of these test results are for released versions of the browsers tested. Versions that are still in development may provide better support for these features. The tests themselves do not test any vendor prefixes.

results

To see the test, click on the link in the left-most column. To see detailed results for a single test, click on the link in the right-most column. To submit test data for a single test, click on the link in the right-most column and then follow the link on that page.

The tables show the latest results from the W3C Test Framework. Below the tables are summaries of the results at a given date. The table data may be more up-to-date than the summary. The tables may also contain some incorrectly scored tests, and tests that relate to non-released versions of browsers. These are not included in the summary.

Basics

Assertion Gecko Presto Trident WebKit Detailed results
HTTP charset Setting the HTTP header charset declaration will affect the encoding of a page.
UTF-16LE BOM A page with no encoding declarations, but with a UTF-16 little-endian BOM will be recognized as UTF-16.
UTF-16BE BOM A page with no encoding declarations, but with a UTF-16 big-endian BOM will be recognized as UTF-16.
XML declaration Setting the encoding in the XML declaration will affect the encoding of a page served as XML.
meta content [Exploratory test] Setting the encoding in the meta content attribute NOT will affect the encoding of a page served as XML.
meta charset [Exploratory test] Setting the encoding in the meta charset attribute NOT will affect the encoding of a page served as XML.
No encoding declaration A page with no encoding information in HTTP, BOM, XML declaration or meta element will be treated as UTF-8.

Snapshot summary, 2012-12-14

These tests all tested the given method of character encoding declaration in isolation. The results were all as expected.

All user agents detected character encodings declared in the HTTP header.

All user agents use little- and big-endian UTF-16 BOMs to set the encoding for UTF-16 pages.

All browsers used the XML declaration to set the character encoding.

Neither the meta Content-Type element nor the HTML5 charset meta element were used by any browsers to set the encoding. This was expected.

A page served without any character encoding information was treated as UTF-8.

Precedence

Assertion Gecko Presto Trident WebKit Detailed results
HTTP vs UTF-8 BOM A character encoding set in the HTTP header has lower precedence than the UTF-8 signature.
HTTP vs UTF-16LE BOM A character encoding set in the HTTP header has lower precedence than the UTF-16LE BOM.
HTTP vs UTF-16BE BOM A character encoding set in the HTTP header has lower precedence than the UTF-16BE BOM.
HTTP vs XML declaration The HTTP header has a higher precedence than an XML declaration.
HTTP vs meta content [Exploratory test] The HTTP header has a higher precedence than an encoding declaration in a meta content attribute.
HTTP vs meta charset [Exploratory test] The HTTP header has a higher precedence than an encoding declaration in a meta charset attribute.
UTF-8 BOM vs XML declaration A page with a UTF-8 BOM will be recognized as UTF-8 even if the XML declaration declares a different encoding.
UTF-16BE BOM vs. XML declaration A page with a UTF-16 big-endian BOM will be recognized as UTF-16 even if the XML declaration declares a different encoding.
UTF-16LE BOM vs. XML declaration A page with a UTF-16 little-endian BOM will be recognized as UTF-16 even if the XML declaration declares a different encoding.
UTF-8 BOM vs meta content [Exploratory test] A page with a UTF-8 BOM will be recognized as UTF-8 even if the meta content attribute declares a different encoding.
UTF-8 BOM vs meta charset [Exploratory test] A page with a UTF-8 BOM will be recognized as UTF-8 even if the meta charset attribute declares a different encoding.
XML declaration vs meta content The XML declaration has a higher precedence than an encoding declaration in a meta content attribute.
XML declaration vs meta charset The XML declaration has a higher precedence than an encoding declaration in a meta charset attribute.

Tests were not run on versions of Internet Explorer below IE9, since those versions don't support XML documents.

Snapshot summary, 2012-03-31

These tests check for precedence when different character encodings are declared for more than one page.

In all browsers except Firefox the byte-order mark at the start of a page overrides any HTTP character encoding declaration. (It is expected that Firefox will soon adopt the same behaviour.)

For all browsers, an HTTP declaration is stronger than that of the XML declaration

The byte-order mark trumps the XML declaration for Firefox, Opera, Chrome and Safari. For Internet Explorer, the XML declaration overrides the UTF-8 BOM. The tests were unclear for the UTF-16 BOMs.

None of the tests featuring either the meta Content-Type or the HTML5 meta charset declaration are significant, since the previous table on this page shows that those declarations are not recognised by browsers in XHTML5 (see tests 6 and 7 above).