Computers only store binary numbers. To represent text (letters, digits, punctuation), a character encoding is needed — a standard that maps each character to a unique number.
ASCII (American Standard Code for Information Interchange) is a 7-bit encoding representing 128 characters (0–127). Most systems use 8-bit extended ASCII, giving 256 characters.
| Range | What it represents | Example |
|---|---|---|
| 0–31 | Control characters (non-printable) | 13 = carriage return, 10 = newline |
| 48–57 | Digit characters '0'–'9' | '0' = 48, '9' = 57 |
| 65–90 | Uppercase letters A–Z | 'A' = 65, 'Z' = 90 |
| 97–122 | Lowercase letters a–z | 'a' = 97, 'z' = 122 |
Uppercase A = 65. Lowercase a = 97. The gap between uppercase and lowercase is always 32 ('a' – 'A' = 32). Each subsequent letter adds 1: 'B' = 66, 'C' = 67, etc.
ASCII was designed for English text only. It cannot represent accented characters (é, ñ), non-Latin scripts (Chinese, Arabic, Hindi), or modern symbols like emoji. As computing became global, a more comprehensive system was needed.
Unicode is an international standard that assigns a unique code point to every character in every writing system in the world. Unicode currently covers over 140,000 characters, including emoji.
| Encoding | Bits per character | Characters supported | Common use |
|---|---|---|---|
| ASCII | 7 (or 8) | 128 (or 256) | English text |
| UTF-8 | 8–32 (variable) | 1,114,112 | Web pages, email, most modern systems |
| UTF-16 | 16 or 32 | 1,114,112 | Windows internals, Java |
| UTF-32 | 32 (fixed) | 1,114,112 | Systems needing fixed-width characters |
The first 128 Unicode code points are identical to ASCII — the letter 'A' is code point 65 in both. This means ASCII text is valid UTF-8, ensuring backward compatibility.
Because Unicode needs to represent far more characters than ASCII, each character may require more bits. Where ASCII uses 7 bits per character, UTF-16 uses 16 bits minimum. A document in UTF-16 will use roughly twice as much storage as the same document in ASCII.
File size in bits = number of characters × bits per character.
8 questions · 17 marks
| Term | Definition |
|---|
Timed exam conditions.