# Unicode

> The universal numbering of every letter and symbol, and why accents sometimes break.

- Level: Intermediate
- Topics: Software
- URL: https://tidbit.legios.com.ar/unicode/
- In Spanish: [Unicode](https://tidbit.legios.com.ar/es/unicode/)

Computers store text as numbers, so every character needs a number. **Unicode** is the worldwide standard that assigns one: `A` is U+0041, `ñ` is U+00F1, the Greek `Ω` is U+03A9, and the emoji 😀 is U+1F600. It covers virtually every writing system in use, plus many historic ones and a lot of symbols, well over a hundred thousand characters in all. Before Unicode, each region used its own incompatible table, and a file written in one often came out garbled in another.

Unicode says which number each character gets; an **encoding** says how to write those numbers as bytes in a file or a network message. The dominant one is **UTF-8**. It stores plain English letters in one byte each, exactly like the old ASCII standard, and uses two to four bytes for everything else. That backward compatibility is a big reason it won: today the vast majority of web pages are UTF-8.

When accents break, this is usually why. If a program writes "año" in UTF-8 and another reads those bytes assuming an older encoding such as Latin-1, each half of the two-byte `ñ` is shown as a separate character and you get "aÃ±o". That garbage has a name, **mojibake**. The fix is almost never to edit the text by hand, but to make both sides agree that the text is UTF-8.

## An analogy

A global phone book that gives every character on Earth its own number. UTF-8 is the way of writing those numbers on paper: short numbers take one box, long ones take several. If the reader assumes every number fits in one box, a two-box number turns into two wrong ones.

## Keep in mind

- Unicode gives every character, from A to ñ to emoji, a unique number.
- UTF-8 is the most common way to store those numbers as bytes.
- Plain English text in UTF-8 is identical to old ASCII.
- "Ã±" instead of "ñ" means the text was read with the wrong encoding.

## Go deeper

- [What is Unicode? (Unicode Consortium)](https://www.unicode.org/standard/WhatIsUnicode.html)
- [UTF-8 (MDN glossary)](https://developer.mozilla.org/en-US/docs/Glossary/UTF-8)
- [The Absolute Minimum Every Software Developer Must Know About Unicode (Joel Spolsky)](https://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-software-developer-absolutely-positively-must-know-about-unicode-and-character-sets-no-excuses/)

## Related terms

- [Emoji](https://tidbit.legios.com.ar/emoji/): Little pictures that are really text characters, drawn differently by each phone maker.
- [Regions and Availability Zones](https://tidbit.legios.com.ar/regions-and-availability-zones/): Where AWS physically lives: cities worldwide, each split into separate data centers.
