When you press a key, the computer stores a number, not a letter. A character set is the agreed list that says which binary code stands for which character. Compare ASCII, extended ASCII and Unicode, and work out codes and storage from a code you are given.
A character set is the complete list of characters a computer can represent, with a unique binary code for each one. ASCII uses 7 bits (128 characters: English letters, digits, punctuation and control codes). Extended ASCII uses 8 bits (256 characters), adding accented letters and symbols. Unicode uses up to 32 bits per character so it can represent every writing system and emoji; its first 128 codes match ASCII. Codes for letters are consecutive, so you can work out one code from another.
Fig. 1: the text "Hi" stored as two character codes
Section 01
Characters as codes.
Type some text into the lab and watch each character become its code and then its binary pattern. Switch between the character sets and compare the bits needed.
Character set
Bits per character
Characters
Covers
ASCII
7 (usually stored in a byte with a leading 0)
27 = 128
English letters, digits 0 to 9, punctuation, control codes
Extended ASCII
8
28 = 256
ASCII plus accented letters, currency and drawing symbols
Unicode
up to 32 (encodings such as UTF-8, UTF-16 and UTF-32)
over a million possible codes
all modern writing systems, symbols and emoji
Compatibility: the first 128 codes of extended ASCII and of Unicode are the same as ASCII.
Why Unicode: 128 or 256 codes cannot cover languages such as Chinese, Arabic or Hindi, so documents could not be exchanged reliably worldwide.
The cost: Unicode can need more bits per character, so the same text may take more storage and longer to transmit.
Examiner trap
You will not be asked to memorise codes. The exam gives you one, such as 'A' = 65, and expects you to work out the others.
Section 02
Working out codes.
Because codes run in order (A, B, C ... and 0, 1, 2 ...), one known code unlocks the rest. In ASCII each lower-case letter is exactly 32 more than its capital.
Worked example Counting along
The ASCII code for 'A' is 65. Give the 8-bit binary code for 'G' and for 'g'.
G is 6 letters after A: 65 + 6 = 71.
71 = 64 + 4 + 2 + 1, so 01000111.
Lower case is 32 more: 71 + 32 = 103 = 64 + 32 + 4 + 2 + 1, so 01100111.
Answer: 'G' = 01000111, 'g' = 01100111
Worked example Digit characters
The code for the character '0' is 48. Give the code for the character '7', and explain how it differs from the integer 7.
'7' is 7 places after '0': 48 + 7 = 55 = 00110111.
The integer 7 is stored as 00000111.
The character is only a symbol for display; it cannot be used in arithmetic until it is converted to a number.
Answer: '7' = 55 = 00110111, not 00000111
Your turn
Given 'A' = 65, which character has the code 01001011?
64 + 8 + 2 + 1 = 75, and 75 − 65 = 10 letters after A: 'K'
Examiner trap
A digit stored as a character is not the same as the number. The string "7" is code 55; the integer 7 is 00000111.
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
How many characters can 7-bit ASCII represent?
Quick check+10 XP
In the lab, why does the Unicode version of the text need more bits than the ASCII version?
Quick check+10 XP
The code for 'a' is 97. What is the code for 'e'?
Quick check+10 XP
Which statement about extended ASCII is correct?
Section 03
How much space does text take?
Storage for plain text is the number of characters multiplied by the bits per character.
Worked example Extended ASCII or UTF-32
A message has 2400 characters. Calculate the storage needed in extended ASCII and in UTF-32, in KiB.
Extended ASCII: 1 byte per character, so 2400 bytes.
2400 ÷ 1024 = 2.34 KiB (to 2 d.p.).
UTF-32: 4 bytes per character, so 9600 bytes = 9600 ÷ 1024 = 9.375 KiB.
Answer: 2.34 KiB and 9.375 KiB
Your turn
A 500-character text uses UTF-16, with 2 bytes for every character. How many bits is that?
500 × 2 = 1000 bytes = 8000 bits
Stage 2 · Exam
Exam-style questions
Unlocks once the four checks above are done. Worth more XP, written to AS Paper 1 and Paper 2 standard.
Finish the four checks above to unlock the exam questions
Exam style+20 XP
The ASCII code for 'M' is 77. What is the 8-bit code for 'P'?
Exam style+20 XP
Why was Unicode introduced?
Exam style+20 XP
A file holds 1000 characters in extended ASCII. How many bits does it need?
Exam style+20 XP
The code for 'A' is 65. A student stores the code 01100011. Which character is it?
Skill unlocked
Character sets, mastered.
This skill is now recorded on your profile. Keep the chain going.