Unicode
The universal numbering of every letter and symbol, and why accents sometimes break.
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.
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)
- UTF-8 (MDN glossary)
- The Absolute Minimum Every Software Developer Must Know About Unicode (Joel Spolsky)