UTF-16BE BOM vs. XML declaration

Click on the link. Test passes if the linked page shows a green square.

Click here

Assertion: A page with a UTF-16 big-endian BOM will be recognized as UTF-16 even if the XML declaration declares a different encoding.


On the target page the XML declaration attempts to set the character encoding to ISO 8859-15. The page starts with a BOM, but there are no other character encoding declarations.

The test contains a div with a class name that contains a sequence of bytes that only reads as ÜÀÚ if the character encoding is UTF-16BE. The external, UTF-8-encoded stylesheet contains a selector .test div.ÜÀÚ. This only matches the class name in the html if sequence of bytes in the html page is interpreted as UTF-16BE. If the class name matches the selector then the top box will turn green.

If the test fails, the characters þÿ may appear at the top of the page, and cause the page to display incorrectly. These represent the bytes that make up the BOM when encountered in the ISO 8859-15 encoding.

Next test

Result summary & related tests
Detailed results for this test