Tool

UTF-8 Mojibake Fixer

Reverse Windows-1252 and Latin-1 mojibake in HTML and plain text. The file stays in this tab.

100% client-side: Your files are repaired locally in your browser and never uploaded.

0 B
0 B
Reference

How the repair works

Mojibake here means a UTF-8 file was read as Windows-1252 or Latin-1 and saved as UTF-8 again. The original bytes remain, but each byte is now its own character, so café shows up as café and a right quote shows up as ’. This page encodes the text back into that single-byte encoding and decodes the bytes as UTF-8. It sits next to HTML Translate. The longer walkthrough is how to fix garbled characters after translating an HTML file.

Decoding is strict. Invalid UTF-8 is left unchanged, and the tool never inserts U+FFFD, because that character cannot be turned back into the original byte. Auto-Detect tries Windows-1252 first, then Latin-1, and keeps a result only when the garbled patterns become fewer. The second pass is for text that was misread twice. Paste or drop one file up to 2 MB. Copy and Download write UTF-8 without a byte-order mark. Read the changed lines before you replace a source file.

Common mojibake

The garbled column is what the file displays. The intended column is what the UTF-8 bytes meant.

Garbled textIntended characterCause
cafécaféUTF-8 C3 A9 for é, read as Windows-1252
’’UTF-8 E2 80 99 for a right quote
——UTF-8 E2 80 94 for an em dash
üüUTF-8 C3 BC for ü
ÂnbspUTF-8 C2 A0 for a non-breaking space, with the second byte shown as a blank

Strict mode and mixed files

Strict mode matches the repair script. The whole file has to fit in Windows-1252 or Latin-1. An emoji, a CJK character, or any other character outside that encoding stops the repair and names the line. Mixed-File Safe splits the file into runs. It reverses a run only when the bytes are valid UTF-8 and the garbled-pattern count goes down, and it leaves the other characters in place.

Replacing a bad byte with U+FFFD deletes the original value, so a later pass cannot recover it. A stopped repair is safer. On HTML, the status bar reports a missing charset or a legacy declaration such as windows-1252. The checkbox rewrites that declaration to UTF-8, or inserts a meta tag after the head start tag. Save the download as UTF-8.

FAQ

Does the fixer upload my HTML or text file?

No. Paste and file drop stay in this browser tab. Repair, copy, and download do not send the text anywhere.

Why does café turn into café?

The UTF-8 bytes for é are C3 A9. Windows-1252 reads them as à and ©. Encoding that text back to Windows-1252 restores the bytes, and a strict UTF-8 decode returns é.

When should I use Mixed-File Safe instead of Strict?

Use Strict when the whole file was misread. If a later edit added an emoji or other text that was already UTF-8, Strict stops. Mixed-File Safe reverses only the runs that decode and look less garbled.

How do I run the same fix in CI?

Use repair_mojibake.py from the repair_mojibake repository on GitHub. Pass --from-encoding cp1252, or latin-1, and write a separate output file. Review the diff before you replace the source. This page is the same reversal for one file.