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 character encoding detection works in current browsers.
These tests check whether user agents recognise character encoding declarations for HTML5 documents. These test pages have HTML syntax and are served as text/html.
Note that 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 do not use any vendor prefixes.
The tables show results for tests run on the date shown. Above the tables are summaries of the results at that date. The table data may be more up-to-date than the summary. If the tables contain some incorrectly scored tests, or tests that relate to non-released versions of browsers, these are not included in the summary.
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. All user agents detected character encodings declared in the HTTP header. For little- and big-endian UTF-16 BOMs, the BOM triggers correct encoding in all browsers. In the absence of other character encoding declarations, the XML declaration was used by Opera, Safari and Chrome to detect the character encoding for HTML documents. This use for HTML is not specified. The The All latest versions of browsers except Internet Explorer (versions 9 and 10) appear to use UTF-8 in the absence of encoding information. Links: Section 8.2.2 • Related tests The BOM overrides the HTTP character encoding declaration for all browsers except Internet Explorer 10. (In Internet Explorer 9 the BOM overwrides the HTTP header, and it is expected that future versions of IE will do so also.) A byte-order mark overrides all in-document declarations in all browsers tested. Although some browsers use the XML declaration to set the encoding in the absence of other information (see the previous table), no browser uses that information in preference to a meta element. (Note that use of the XML declaration is not described in the HTML spec.) When both a Links: Section 8.2.2.1 • Related tests
Basic character encoding
Snapshot summary, 2014-02-17
Firefox 27.0, Chrome 32.0.1700.107, Safari 6.1.1, Internet Explorer 9, Opera 19.0meta
content
attribute was used by all browsers to set the encoding.meta
charset
attribute was also recognized by all browsers.
Test link
Assertion
Details
HTTP charset
The character encoding of a page can be set using the HTTP header charset declaration.
the-input-byte-stream-001
UTF-16LE BOM
A page with no encoding declarations, but with a UTF-16 little-endian BOM will be recognized as UTF-16.
the-input-byte-stream-003
UTF-16BE BOM
A page with no encoding declarations, but with a UTF-16 big-endian BOM will be recognized as UTF-16.
the-input-byte-stream-004
XML declaration
[Exploratory] Setting the encoding in the XML declaration will NOT affect the encoding of a page served as text/html.
the-input-byte-stream-006
meta content attribute
The character encoding of the page can be set by a meta element with http-equiv and content attributes.
the-input-byte-stream-007
meta charset attribute
The character encoding of the page can be set by a meta element with charset attribute.
the-input-byte-stream-009
No encoding declaration
A page with no encoding information in HTTP, BOM, XML declaration or meta element will be treated as UTF-8.
the-input-byte-stream-015
Character encoding precedence
Snapshot summary, 2014-02-17
Firefox 27.0, Chrome 32.0.1700.107, Safari 6.1.1, Internet Explorer 9, Opera 19.0meta
content
attribute and meta
charset
attribute appear in an HTML page, the first always trumps the second.
Test link
Assertion
Details
HTTP vs UTF-8 BOM
A character encoding set in the HTTP header has lower precedence than the UTF-8 signature.
the-input-byte-stream-034
HTTP vs XML declaration
[Exploratory] The HTTP header has a higher precedence than an XML declaration.
the-input-byte-stream-022
HTTP vs meta content
The HTTP header has a higher precedence than an encoding declaration in a meta content attribute.
the-input-byte-stream-016
HTTP vs meta charset
The HTTP header has a higher precedence than an encoding declaration in a meta charset attribute.
the-input-byte-stream-018
UTF-8 BOM vs meta content
A page with a UTF-8 BOM will be recognized as UTF-8 even if the meta content attribute declares a different encoding.
the-input-byte-stream-037
UTF-8 BOM vs meta charset
A page with a UTF-8 BOM will be recognized as UTF-8 even if the meta charset attribute declares a different encoding.
the-input-byte-stream-038
XML declaration vs meta content
[Exploratory] The XML declaration has a lower precedence than an encoding declaration in a meta content attribute.
the-input-byte-stream-024
XML declaration vs meta charset
[Exploratory] The XML declaration has a lower precedence than an encoding declaration in a meta charset attribute.
the-input-byte-stream-026
meta content, then meta charset
[Exploratory] An encoding declaration in a meta content attribute has a higher precedence than a following encoding declaration in a meta charset attribute.
the-input-byte-stream-027
meta charset, then meta content
[Exploratory] An encoding declaration in a meta charset attribute has a higher precedence than a following encoding declaration in a meta charset attribute.
the-input-byte-stream-030