Paste text that an encoding mistake mangled. This recovers the original exactly, tells you the full set of codecs that could have caused the damage, and names the positions that cannot be recovered at all. Everything runs in this tab.
Mojibake happens when bytes written as UTF-8 get read back with a legacy single-byte codec. The damage is a pure byte-for-byte substitution, so it inverts exactly: map each character back to its byte under a candidate codec, then require the byte run to be valid UTF-8. Codecs that survive that filter are ranked by a plausibility score.
WHATWG windows-1252 maps all 256 byte values. Python's strict cp1252 refuses five of them. The closing curly quote U+201D is e2 80 9d in UTF-8, and 0x9d is one of those five, so a sentence with quoted speech breaks the standard server-side one-liner while this page recovers it exactly.
There are two distinct failures at two different steps, and they raise different exceptions. Pick which text to trace:
There is no true ISO-8859-1 decoder in any browser. The Encoding Standard folds every ISO-8859-1 label onto windows-1252, so an implementer who lists latin1 and iso-8859-1 as two separate candidates has silently tested windows-1252 twice and has never tested true ISO-8859-1 damage at all. This tool hand-builds ISO-8859-1 as an identity map, byte n to code point n, and runs it as a real candidate.
No encoding tables ship in this file. Every map below is read out of this browser's own TextDecoder at page load, one byte at a time, and the ISO-8859-1 row is generated arithmetically. Counts are what this run measured.
A grid of original strings is damaged with several codecs, then fed back through the inverter. The numbers below are produced by that run, not quoted from anywhere.
U+FFFD and the original byte is gone. Those positions are listed as unrecoverable, not guessed. The text either side of a hole is still inverted and returned, with the hole left exactly as it arrived.ftfy is the well-known Python library for this job and it is very good. The difference here is scope, not quality: nothing to install, it runs on a paste, it reports the whole candidate set rather than one answer, it names the unrecoverable positions, and it handles the five bytes that strict Python cp1252 refuses outright. If you can run Python and you want a batch fix inside a pipeline, use ftfy.
Behaviour here was reimplemented from the published Encoding Standard and measured empirically in this browser. No code is reproduced from any other project.
This tool is independent and unaffiliated with ftfy and its maintainers, the Python Software Foundation, the WHATWG, and Microsoft. Product and codec names are used only to identify the behaviour being measured.