The Problem: Computers Only Understand Numbers
A computer stores everything as binary numbers. But how does it store a letter like A or a symbol like ?? Humans and computers needed to agree on a shared system: a table that maps each character to a specific number.
What is ASCII?
ASCII stands for American Standard Code for Information Interchange. It was created in the 1960s and assigns a 7-bit number (0–127) to 128 characters, including:
- Uppercase letters (A–Z)
- Lowercase letters (a–z)
- Digits (0–9)
- Punctuation marks (!, ?, ., etc.)
- Special control characters (like "new line" or "tab")
Here are some key ASCII values to know:
| Character | Decimal | Binary |
|---|---|---|
| A | 65 | 1000001 |
| B | 66 | 1000010 |
| a | 97 | 1100001 |
| 0 | 48 | 0110000 |
| Space | 32 | 0100000 |
Notice that uppercase letters start at 65 and lowercase at 97. The difference is exactly 32. This makes it easy for programs to switch between cases — just add or subtract 32 from the ASCII value.
Limitations of ASCII
ASCII was designed for English. It cannot represent:
- Letters with accents: é, ü, ñ
- Non-Latin scripts: Chinese, Arabic, Greek
- Modern symbols: emoji, currency signs like €
With only 128 values, ASCII simply does not have room for the world's languages.
Unicode and UTF-8
To fix ASCII's limitations, Unicode was created. It defines over 140,000 characters covering almost every writing system on Earth, plus thousands of emoji.
UTF-8 is the most popular way of encoding Unicode text. It is clever because:
- Standard ASCII characters still use just 1 byte (staying compatible with old systems)
- Less common characters use 2, 3, or 4 bytes as needed
Today, nearly all websites and modern software use UTF-8.
If you have ever seen garbled text like "é" where there should be "é", that is a character encoding mismatch — the file was saved in one encoding and opened with another.
How Much Space Does Text Use?
In ASCII or UTF-8, a typical English character takes 1 byte. So:
- "Hello" = 5 bytes
- A 500-word essay ≈ 3,000 bytes ≈ 3 KB
This is one reason plain text files are tiny compared to images or videos.
Practice Problems
Using the ASCII table, what is the binary representation of the word 'Hi'? (H = 72, i = 105)
Show answer
Why was Unicode developed to replace ASCII, and what is the main advantage of UTF-8 over a fixed-width Unicode encoding?