</> ConvertAtlas Developer Tools
Data formats

Character Encoding and UTF-8: Why Text Breaks

What encoding actually is, why UTF-8 won, and the cause behind those mysterious garbled characters.

A é 語 1 byte 2 bytes 3 bytes

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.

A é 語 1 byte 2 bytes 3 bytes
UTF-8 uses a variable number of bytes per character: 1 for ASCII, more for the rest of Unicode.

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.

Try it: Text to Binary ConverterConvert text to binary and binary back to text.

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.