Every developer eventually meets garbled text — a name that turns into "José" or a smart quote that becomes three random symbols. The cause is almost always a character encoding mismatch. Understanding what encoding is, and why UTF-8 became the answer, makes these bugs predictable and fixable instead of mysterious.
Characters are not bytes
Computers store bytes; humans read characters. An encoding is the agreed mapping between the two. The trouble began because early encodings like ASCII only covered 128 characters — fine for English, useless for most of the world. Dozens of incompatible encodings sprang up to fill the gap, and mixing them up is what corrupts text.
Why UTF-8 won
Unicode assigns a unique number to every character in every writing system. UTF-8 is the encoding that turns those numbers into bytes, and it won for an elegant reason: it is backward-compatible with ASCII. The first 128 characters use a single byte identical to ASCII, while other characters use two to four bytes. Old ASCII text is already valid UTF-8, which made adoption painless. Today UTF-8 is the default for the web and most systems.
What causes garbled text
The classic "mojibake" happens when text is written in one encoding and read in another. Bytes that meant an accented letter in UTF-8 get interpreted as two separate characters in an older encoding, producing the familiar gibberish. The fix is consistency: declare UTF-8 everywhere — in your database, your HTTP headers, your HTML meta tag, and your editor — so the same encoding is used end to end.
The practical rule
Use UTF-8 for everything, declare it explicitly at every layer, and never assume a byte stream’s encoding — always know it. Doing so eliminates an entire category of bugs that has plagued software for decades.