How text is stored: character sets and encoding
Computer Science · Key Stage 3 · The School
Every letter is secretly a number
A computer stores nothing but numbers. To store text, each character is assigned a number by an agreed CHARACTER SET, and the computer stores that number. The letter is only ever a letter when a program reads the number back and displays the matching symbol on screen.
ASCII: the original agreement
ASCII assigns numbers 0 to 127 to English letters, digits, punctuation and a few control codes. Capital A is 65. Lowercase a is 97. Since 128 numbers fit inside just seven binary digits, ASCII is compact and fast. Its real limit is that it has no numbers at all for accented letters, Arabic script, Chinese characters, or emoji.
Unicode: one system for the whole world
UNICODE assigns a number to almost every character in almost every writing system used on Earth, plus symbols and emoji, well over a hundred thousand in total. The first 128 Unicode numbers are deliberately identical to ASCII, so older ASCII text still reads correctly inside the newer, much bigger system.
The English letter A sits near the very start of Unicode, at number 65, and can be stored in a single byte using a common encoding called UTF-8. A single emoji, such as a thumbs-up, sits at a much higher number, far outside that first small block, and needs FOUR bytes to store in the very same encoding. Ten emoji in a message can genuinely take more storage than a hundred English letters. The character set decides the number; the ENCODING decides how many bytes that number costs to store.