When you press a key, the computer does not store a letter: it stores a number, written in binary. A character set is the agreed list that says which number stands for which character, so every computer reads the same text in the same way.
Text must be converted to binary before a computer can process it. A character set gives every character a unique binary code. ASCII uses 7 bits (128 characters), and extended ASCII 8 bits (256 characters): enough for English letters, digits and symbols. Unicode allows a far greater range of characters and symbols, including different languages and emojis, but it needs more bits per character (up to 32), so the same text takes more storage.
Fig. 1: the text Hi! stored as three ASCII codes
Section 01
Text is numbers.
Type some text into the lab and watch each character turn into its code and then into binary.
Character set: a list of all the characters a computer can use, each with its own unique binary code.
Why it matters: computers sending and receiving text must use the same character set, or the codes are read as the wrong characters.
Codes run in order: in ASCII, A = 65, B = 66, C = 67 ... and a = 97, b = 98 ... ; the digit 0 is 48. If you know one code you can work out the rest.
Worked example Codes in sequence
The ASCII code for A is 65. Give the 8-bit binary code for E.
E is 4 letters after A, so its code is 65 + 4 = 69.
69 = 64 + 4 + 1.
Answer: 01000101
Your turn
The ASCII code for c is 99. Give the denary and binary codes for g.
99 + 4 = 103 = 01100111
Examiner trap
The digit character 7 is not stored as the number 7. In ASCII it is code 55, so text digits cannot be used in a calculation until they are converted.
Section 02
ASCII and Unicode.
Switch the lab between ASCII and Unicode and add a character from another language or an emoji. Watch the number of bits per character.
ASCII
Unicode
Bits per character
7 (8 for extended ASCII)
more: up to 32
Number of characters
128 (256 extended)
over a million possible
Covers
English letters, digits, punctuation, control codes
almost every language, maths symbols and emojis
Storage for the same text
less
more
Examiner trap
Saying Unicode is "better" earns nothing. Say it has a greater range of characters (other languages, emojis) but uses more bits per character, so files are bigger.
Stage 1 · Learn
Check what the sim just showed you
Four quick checks. Each correct answer earns XP and records this skill on your profile.
Quick check+10 XP
Why must text be converted to binary?
Quick check+10 XP
What is an advantage of Unicode over ASCII?
Quick check+10 XP
The ASCII code for a is 97. What is the code for d?
Quick check+10 XP
In the lab, what happens to the storage needed when you switch the same text from ASCII to Unicode?
Section 03
How much space does text take?
The storage needed is the number of characters multiplied by the bits per character. Spaces and punctuation are characters too.
Worked example Same message, two character sets
A message has 20 characters. How many bytes does it take in 8-bit ASCII and in a 32-bit Unicode encoding?