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.
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.
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.
Assertion | Gecko | Presto | Trident | WebKit | Detailed results | |
---|---|---|---|---|---|---|
HTTP charset | Setting the HTTP header charset declaration will affect the encoding of a page. | character-encoding-xhtml-001 | ||||
UTF-16LE BOM | A page with no encoding declarations, but with a UTF-16 little-endian BOM will be recognized as UTF-16. | character-encoding-xhtml-003 | ||||
UTF-16BE BOM | A page with no encoding declarations, but with a UTF-16 big-endian BOM will be recognized as UTF-16. | character-encoding-xhtml-004 | ||||
XML declaration | Setting the encoding in the XML declaration will affect the encoding of a page served as XML. | character-encoding-xhtml-005 | ||||
meta content | [Exploratory test] Setting the encoding in the meta content attribute NOT will affect the encoding of a page served as XML. | character-encoding-xhtml-006 | ||||
meta charset | [Exploratory test] Setting the encoding in the meta charset attribute NOT will affect the encoding of a page served as XML. | character-encoding-xhtml-007 | ||||
No encoding declaration | A page with no encoding information in HTTP, BOM, XML declaration or meta element will be treated as UTF-8. | character-encoding-xhtml-008 |
Links: Section 4.3.3 • Latest results for section 4.3.3 • Submit data for section 4.3.3 • Related tests
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.
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. | character-encoding-xhtml-010 | ||||
HTTP vs UTF-16LE BOM | A character encoding set in the HTTP header has lower precedence than the UTF-16LE BOM. | character-encoding-xhtml-011 | ||||
HTTP vs UTF-16BE BOM | A character encoding set in the HTTP header has lower precedence than the UTF-16BE BOM. | character-encoding-xhtml-012 | ||||
HTTP vs XML declaration | The HTTP header has a higher precedence than an XML declaration. | character-encoding-xhtml-014 | ||||
HTTP vs meta content | [Exploratory test] The HTTP header has a higher precedence than an encoding declaration in a meta content attribute. | character-encoding-xhtml-015 | ||||
HTTP vs meta charset | [Exploratory test] The HTTP header has a higher precedence than an encoding declaration in a meta charset attribute. | character-encoding-xhtml-016 | ||||
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. | character-encoding-xhtml-017 | ||||
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. | character-encoding-xhtml-018 | ||||
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. | character-encoding-xhtml-019 | ||||
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. | character-encoding-xhtml-020 | ||||
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. | character-encoding-xhtml-021 | ||||
XML declaration vs meta content | The XML declaration has a higher precedence than an encoding declaration in a meta content attribute. | character-encoding-xhtml-022 | ||||
XML declaration vs meta charset | The XML declaration has a higher precedence than an encoding declaration in a meta charset attribute. | character-encoding-xhtml-023 |
Links: Section 4.3.3 • Latest results for section 4.3.3 • Submit data for section 4.3.3 • Related tests
Tests were not run on versions of Internet Explorer below IE9, since those versions don't support XML documents.
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).