How to fix mojibake when UTF-8 text turns into gibberish

By TechCompare · Updated · How we check

Mojibake is always caused by a mismatch between the encoding used to write bytes and the encoding used to read them. Fix it by identifying both encodings and reinterpreting correctly. Prevent it by using UTF-8 everywhere and declaring it explicitly.

UTF-8 characters read as Windows-1252

CharacterUTF-8 (hex)Shows as
éC3 A9é
üC3 BCü
£C2 A3£
€E2 82 AC€
’E2 80 99’
“E2 80 9C“

Every byte turns into its own character, so a lot of Ã, Â and â in your text points to this mix-up. Select the garbled form to fix it in the Encoding Converter.

Mojibake (Japanese for 'character transformation') is the garbled text you see when bytes written in one encoding are read as another. The classic case is UTF-8 read as Windows-1252, which is what browsers use for anything labeled Latin-1: é turns into é and it’s turns into it’s. The bytes are intact. The reader is just using the wrong encoding, so fixing it means knowing what encoding the text was written in and what encoding it's being read as.

Encoding focus
Fixing mojibake
mojibake
Category
Pitfalls
Common encoding problems and fixes

How this is calculated

Common mojibake scenarios: a MySQL database column was created as latin1 but the application writes UTF-8 bytes into it, a CSV file exported from Excel doesn't include a BOM and is opened as ASCII, or an API response declares charset=ISO-8859-1 but actually returns UTF-8.

Recovery depends on whether the bytes were transcoded or just mislabeled. If they were only mislabeled, reopen them with the correct encoding and nothing is lost. If the garbled text was saved again, every save adds a layer. Café was garbled twice, so it takes two rounds to get back to Café. The Encoding Converter's Fix garbled text mode shows the bytes of every layer.

Copying garbled text can lose a byte. A closing ” is E2 80 9D in UTF-8, and Windows-1252 shows its last byte as an invisible control character. Copy and paste often drops it and leaves †on its own.

Prevention is simpler than recovery: always declare UTF-8 explicitly, file formats included.

Verdict

Prevent mojibake by declaring UTF-8 in HTTP headers, meta tags, and schema definitions. To fix existing gibberish, reinterpret mislabeled bytes with the right encoding, and reverse double-encoded ones one layer at a time. Most cases come from a latin1 MySQL column receiving UTF-8 bytes, an Excel CSV exported without a BOM, or an API header lying about its charset.

More Encoding scenarios

Base64 vs Hex
Base64 and hexadecimal both encode binary data as text, but they have different purposes.
View details
UTF-8 vs ASCII
ASCII maps 128 English characters to 7-bit values.
View details
URL encoding guide
Percent-encoding (also called URL encoding) represents a byte with a percent sign followed by two hex digits when that byte can't appear literally in the URL component being built.
View details

Frequently asked questions

What is mojibake and what causes it?
Mojibake is garbled output like é where é belonged. It happens when bytes written in one encoding get decoded as another, most often UTF-8 read as Latin-1. The underlying bytes are intact. The reader is just using the wrong translation table, which is why mojibake is usually fixable once you identify both ends of the mismatch.
Why does my database show é instead of é?
The classic cause is a MySQL column declared latin1 receiving UTF-8 bytes from the application. The client wrote UTF-8, the table claims latin1, and reading back translates each UTF-8 byte into a separate Latin-1 character. Fix the column to utf8mb4, then re-import or repair the existing rows that were double-baked.
How do I fix text that was double-encoded to UTF-8?
Reverse the layers one at a time. Double encoding usually means UTF-8 bytes were read as Windows-1252 (often labeled Latin-1) and then saved as UTF-8 again. To undo one layer, turn each character back into its Windows-1252 byte and decode those bytes as UTF-8. The Encoding Converter's Fix garbled text mode repeats that until nothing changes, so Café comes back as Café after two layers. Prevention beats repair: declare UTF-8 explicitly in HTTP headers, HTML meta tags, and database schemas.
Why does a closing quote turn into †with nothing after it?
In UTF-8, ” is E2 80 9D. Read as Windows-1252, it shows as †followed by an invisible control character, because Windows-1252 has no character for the last byte. Copy and paste often drops that invisible character, so only †is left. The Fix garbled text mode reads a lone †as a lost closing quote, fills the missing byte back in and marks it so you can check the spot.