Home / Guides

Mojibake: Why Text Turns Into é and ’, and How to Fix It

Published 2026-10-16

Mojibake is text that has turned into nonsense symbols: an é that became é, an apostrophe that became ’. The letters were never damaged. They were stored with one character encoding and read with another. This guide shows the usual patterns, explains the byte order mark, and gives you ways to repair the text and stop it happening again.

What is mojibake?

The word is Japanese and means roughly transformed characters. Japan met the problem early, because several incompatible encodings for Japanese were in use at the same time. In English the same thing is called garbled text.

A computer stores text as bytes. An encoding is the table that says which bytes stand for which characters. As long as the program that reads the bytes uses the same table as the program that wrote them, everything works. When the reader assumes a different table, the bytes are still intact but they are shown as the wrong characters.

The most common cause: UTF-8 read as Windows-1252

UTF-8 is the standard encoding of the web. It stores the basic English letters, digits and punctuation in one byte each, and every other character in two, three or four bytes. Windows-1252 and its close relative Latin-1 (ISO 8859-1) are older Western European encodings that store every character in exactly one byte.

When UTF-8 text is read as Windows-1252, each of those multi-byte characters is shown as two or three separate characters. English text survives almost untouched, because its letters are the same in both tables. Only accented letters, curly quotes, dashes and symbols break, which is why the damage looks so scattered.

MeantUTF-8 bytesShown as
éC3 A9é
üC3 BCü
ñC3 B1ñ
’ (curly apostrophe)E2 80 99’
“ (opening curly quote)E2 80 9C“
– (en dash)E2 80 93–
— (em dash)E2 80 94—
… (ellipsis)E2 80 A6…
• (bullet)E2 80 A2•
€E2 82 AC€
£C2 A3£
©C2 A9©
°C2 B0°
Non-breaking spaceC2 A0Â followed by a space

Two patterns are worth remembering. A stray à in front of a symbol means an accented letter. The sequence †followed by one more character means a curly quote, a dash or another piece of typographic punctuation. The closing curly quote is a special case: its third byte has no character in Windows-1252, so you often see †with nothing visible after it.

Other patterns you may see

The replacement character

The opposite mistake, older one-byte text read as UTF-8, produces a different symptom. A lone byte such as the Latin-1 E9 for é is not valid UTF-8, so the reader substitutes the replacement character U+FFFD, drawn as a question mark inside a black diamond. The word café comes out with that diamond in place of its last letter.

Double encoding

If garbled text is saved as UTF-8 and misread a second time, the damage stacks up. The é that became é turns into é. Long runs of à and  are the signature of text that has been through the mistake more than once.

Plain question marks

When a program converts text into an encoding that has no code for a character, it often writes an ordinary question mark instead. This is not mojibake in the strict sense, and it cannot be undone, because the original byte is gone.

East Asian text

The same mechanism affects every script. Chinese readers know a famous three-character sequence, 锟斤拷, which appears when two replacement characters saved as UTF-8 are read with the Chinese GBK encoding.

The byte order mark (BOM)

The byte order mark is the character U+FEFF placed at the very start of a file. In UTF-16, which stores text in two-byte units, it has a real job: it tells the reader which byte of each unit comes first. In UTF-8 there is no byte order to mark, so there it serves only as a label saying that the file is UTF-8.

EncodingBOM bytes
UTF-8EF BB BF
UTF-16, little-endianFF FE
UTF-16, big-endianFE FF

A UTF-8 BOM is optional, and whether you want one depends on who reads the file:

When a UTF-8 BOM is itself misread as Windows-1252, it appears as the three characters  at the top of the page or file.

How to fix garbled text

The first rule is not to retype or search-and-replace in a hurry. If the bytes are intact, the right fix is to read them again with the correct encoding.

iconv -f WINDOWS-1252 -t UTF-8 old.txt > new.txt

If the garbled characters have already been saved as text, for instance in a database, you can often reverse the mistake in code. In Python, this turns é back into é:

fixed = broken.encode("cp1252").decode("utf-8")

It raises an error when the text contains characters that cannot be mapped back, and text that was damaged twice needs the step twice. The open-source Python library ftfy automates the detective work for mixed cases.

How to prevent it

What a text cleaner can and cannot do

The AI Text Cleaner does not repair mojibake. Undoing it means reinterpreting bytes, and by the time text is pasted into a web page, the bytes have already been turned into characters. What the cleaner can do is remove a byte order mark that came along with pasted text. With Remove invisible characters switched on, a U+FEFF is deleted and shown in the list of characters found. It leaves the replacement character U+FFFD in place, since deleting it would hide the fact that a letter is missing.

Quick answers

Why does an apostrophe turn into three strange symbols? A curly apostrophe takes three bytes in UTF-8. Read as Windows-1252, each byte is shown as its own character.

Can mojibake always be reversed? No. It can be reversed while the original bytes are still there. Once characters have been replaced by question marks or replacement characters, that information is lost.

Should I save my files with or without a UTF-8 BOM? Without, in most cases, and especially for code, JSON and web pages. Add it only for a program that needs it, such as a CSV file meant to be opened directly in Excel.

Try it on your own text. Once the encoding is fixed, paste the text to clear a leftover byte order mark and other hidden characters. Open the AI Text Cleaner

Related guides