Text, Sound and Images · Cambridge syllabus 1.2 · Lesson 1 of 3
Character Representation
A character set assigns codes to characters. ASCII defines a relatively small set, while Unicode assigns code points covering many writing systems and symbols. Each character's code is stored as binary, and Unicode needs more bits per character than ASCII.
By the end, you can
- Understand how computers represent text using binary.
- Understand the purpose of a character set.
- Explain the use of ASCII.
- Explain the use of Unicode.
- Recognise why Unicode supports a much wider range of characters than ASCII.
Character sets
Text has to be stored as numbers, so every character is given a code, and a character set is the agreed table of which code means which character.
ASCII uses 7 bits, giving 128 codes, which covers the English alphabet in both cases, the digits, punctuation and some control characters.
The codes are arranged deliberately. A to Z run consecutively from 65, and a to z from 97, so the gap between a capital and its lower-case letter is always 32. Converting case is therefore arithmetic rather than a lookup, which is a common exam question.
ASCII cannot represent Chinese, Arabic, Hindi or emoji, because 128 codes are nowhere near enough. Unicode solves that by using more bits — up to 32 — giving over a million codes covering every writing system in use. The trade-off is size: a Unicode file can take several times the storage of the same text in ASCII, which is why ASCII is still used where only English is needed.
The first 128 Unicode codes match ASCII exactly, so ASCII files are already valid Unicode.
Worth remembering
- A character set maps each character to a number; ASCII is 7-bit, 128 characters.
- Upper and lower case differ by 32, so case conversion is arithmetic.
- Unicode covers every writing system but needs more storage per character.
Worked example
ASCII capital A has code 65, represented as 01000001 in an eight-bit byte. Unicode U+0041 identifies the same character.
Practice
Warm-up · not marked
Check your understanding
Answer in your own words, then compare with the worked answer. Nothing here is saved or scored.
Worked answer
Unicode can represent characters from many writing systems that are absent from ASCII.
Check your method, units and explanation against it.
Marked practice
Set 1 of 4 · easiest first · Checked as you go, with the worked answer. Sign in or create a free account to save your progress.