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.
- Hard
- HTTP only
- Answer key
/messy/encoding/answers.json
| Page | The bytes are | Content-Type says | Meta tag says |
|---|---|---|---|
| windows-1252 | windows-1252 | text/html; charset=windows-1252 | utf-8 |
| mislabelled | utf-8 | text/html; charset=iso-8859-1 | utf-8 |
| bom | utf-8, with a BOM | text/html; charset=windows-1252 | utf-8 |
Data version 1.0.0. Everything here is made up: products, brands, people, towns. tests.json · robots.txt · Source