Skip to content

All tests / Messy content

Character encodings

What this tests. Three pages where the bytes, the Content-Type header and the meta tag disagree about the encoding. Get the pound signs and curly quotes right.

The rule. Each page lists the same five lines of stock, full of pound and euro signs, accents and curly quotes. What differs is the label on the bytes. A byte order mark at the start wins over everything. Without one, bytes that decode cleanly as UTF-8 are UTF-8, whatever the header claims. Only bytes that aren't valid UTF-8 should be decoded by the header. Your output should read Müller’s “quiet” kettle, €39.00, with no ü and no question marks.

PageThe bytes areContent-Type saysMeta tag says
windows-1252windows-1252text/html; charset=windows-1252utf-8
mislabelledutf-8text/html; charset=iso-8859-1utf-8
bomutf-8, with a BOMtext/html; charset=windows-1252utf-8

Data version 1.0.0. Everything here is made up: products, brands, people, towns. tests.json · robots.txt · Source