1. What does garbled text look like, and why is it called mojibake?
Have you ever seen a word like “café” where “café” should be? Or a curly apostrophe that shows up as “’”? This is called mojibake. The word comes from Japanese, where 文字化け is usually glossed as “character transformation” [8]. English speakers now use the Japanese word for this kind of garbled text.
Here is what is odd about it. The text in the file is not broken. If you open the same file with the right setting, “café” comes back, letter for letter. The garbling happens when a program reads the file, so the question is what it did differently.
2. Why can the same bytes turn into different characters?
A computer stores text as numbers, in units called bytes. To turn bytes back into letters, it needs a table that says which number means which character. That table is called a character encoding. The W3C’s explanation puts it this way: an encoding is a set of mappings between the bytes in the computer and the characters in a character set, and the same byte can mean different characters under different encodings [1].
The W3C gives an example. The number 233 is é in the table called ISO 8859-1, but it is a Cyrillic letter in ISO 8859-5 [1]. So a byte does not carry its meaning with it. The meaning comes from the table that the reader picks, and a wrong pick gives wrong letters.
3. How does “café” become “café”?
Take the letter é. In UTF-8, the most common encoding today, it is stored as two bytes: C3 and A9 (written in hexadecimal, a counting system with sixteen digits, 0 to 9 and A to F). In the older ISO 8859-1 table, é is a single byte, E9 (233 in everyday numbers) [1].
Now suppose a file saved in UTF-8 is opened by a program that assumes a one-byte-per-letter table such as Windows-1252, similar to ISO 8859-1. The program sees C3 and treats it as a whole letter. In that table, C3 is “Ô and A9 is “©”. So “é” appears as “é”, and “café” appears as “café”. (We worked out these byte values with Python’s standard text codecs. The table lookup is the same one a browser makes.)
| What was saved | Its UTF-8 bytes | Read as Windows-1252 |
|---|---|---|
| é | C3 A9 | é |
| £ | C2 A3 | £ |
| ’ (curly apostrophe) | E2 80 99 | ’ |
| € | E2 82 AC | € |
Notice that plain English letters never change. That is why English readers often meet mojibake only in names, prices and punctuation. Why do plain letters survive? To answer that, we need to go back to where the first table came from.
4. Why did the first code table leave out letters like é?
The table that almost everything else builds on is ASCII. The American Standards Association’s X3.2 subcommittee began the work in 1960 and published the first edition in 1963. ASCII defines 128 characters, each a 7-bit binary number: 33 control codes (such as the one for a new line) and 95 printable characters. Its first large commercial use was on AT&T’s Teletypewriter eXchange network, with Teletype Model 33 machines [2].
Those 95 printable characters cover the English alphabet, digits and basic punctuation. There was no space for é, ñ, or letters from other alphabets. Later tables, such as ISO 8859-1 for Western European languages and ISO 8859-5 for Cyrillic [1], used the extra numbers differently from each other. That is exactly how a single number came to mean different letters. Because every one of these tables keeps the ASCII range as it is, plain English text reads the same under all of them.
5. How did UTF-8 mostly end the mix-ups?
If many tables cause confusion, one table for everyone would solve it. That idea is Unicode, whose first version came out in October 1991 [3]. Unicode gives each character a number, and its code space runs from U+0000 to U+10FFFF [4]. UTF-8 is one way to write those numbers as bytes [4].
UTF-8 has an origin story. Rob Pike, who worked on the Plan 9 operating system, wrote that it was designed “on a placemat in a New Jersey diner one night in September or so 1992,” by his colleague Ken, with Pike cheering him on. Plan 9 had been using the original UTF from the ISO 10646 standard, and, in Pike’s words, “we hated it.” Pike recalled that one thing they wanted was the ability to pick up a byte stream in the middle and still find where the characters begin. The next day, the code was done [5].
The finished design, written down in RFC 3629 (an official internet standard from November 2003), has two features that matter for our question [6]:
- A plain ASCII string is already valid UTF-8, and ASCII byte values appear only for ASCII characters. Old English-only files stay readable.
- Every byte after the first in a multi-byte character starts with the bits 10, so character boundaries can be found from anywhere in a stream.
With one table that covers all the world’s writing, there is far less reason to guess which table a file used.
6. If UTF-8 is so common, why do we still see mojibake?
Mostly because of old habits. The WHATWG Encoding Standard, which describes how web browsers read text, requires UTF-8 for new protocols and formats [7]. It also treats the label “iso-8859-1” as a synonym for windows-1252 [7], so a page that is mislabeled in that way is read as the old one-byte table, and our “café” appears. Web statistics from W3Techs show UTF-8 used by 99.1% of the websites whose encoding is known (October 2026; the figure updates daily) [9]. That is a share of sites with a known encoding, not of every site. Old files, old software and wrong labels make up what is left.
The W3C adds a warning for anyone who runs into this: declaring a different encoding on a page does not change its bytes. The text must actually be saved in the encoding you declare [1].
7. How can you see a byte table at work yourself?
You do not need to break anything. Try this on paper.
- Write the word “café” and mark the é.
- Write its UTF-8 bytes: C3 A9.
- Use this mini chart for Windows-1252: C2 is Â, C3 is Ã, A3 is £, and A9 is ©. Which letters do you land on for C3 A9?
- Now do the same for “£”, which is C2 A3 in UTF-8. Does it match the table above?
If you want to go further, read the short email in which Rob Pike tells the UTF-8 story [5], and RFC 3629 [6]. Both are free online and written for adults, but a curious reader can handle the first one with some help.