Why this matters
When you type the letter "M", the computer does not store a shape. It stores a number. If you have ever opened a file and seen garbled symbols, that is what happens when the rules for turning letters into numbers get crossed. Character codes explain both how text is stored and why it sometimes breaks.
The idea
Every character gets a character code, a unique number. The lookup table that pairs characters with codes is a character code system.
ASCII is the classic one: it covers English letters, digits, punctuation, and control codes, using 1 byte per character. Since 1 byte = 8 bits, ASCII has room for 256 characters. It has no room for Japanese, Arabic, or emoji.
Unicode solves that by giving the world's writing systems one shared system. With 2 bytes you can represent 65,536 characters. UTF-8 and UTF-16 are different ways of packing Unicode.
Turning a string into codes is encoding; turning codes back into a string is decoding. If the sender encodes one way and the reader decodes another, you get character corruption: that familiar wall of garbled symbols.
A code alone is not enough to show the character. The computer also needs a font, the shape data for each code. So displaying text needs two things: the character code and the font.
Picture it
flowchart LR S["String: Hi"] -->|encode| C["Codes: 48 69 (hex)"] C -->|decode| S C -->|plus font| G["Drawn glyphs on screen"]
Worked example
Using the ASCII table, encode the word Love. Each letter has a hex code: L = 4C, o = 6F, v = 76, e = 65. Joined together that is 4C6F7665 in hexadecimal.
Decoding works in reverse. Split 4C6F7665 into pairs (4C, 6F, 76, 65), look each up, and you get back L, o, v, e → Love. If the wrong system were used to decode, those same bytes would come out as different, nonsense characters: character corruption.
Your turn
Try the practice: match each term (character code, ASCII, Unicode, font) to its meaning, and pick how many characters one byte can hold.
Recap
- A character code is the number for a character; a code system (ASCII, Unicode) is the table.
- ASCII = 1 byte = up to 256 characters; Unicode covers all languages (2 bytes → 65,536).
- Encoding ↔ decoding; a mismatch causes character corruption. Showing text needs code + font.