SLIDE 1 / 10
CSZone.co.uk
Click anywhere to advance · Arrow keys also work
AQA 7517 · Paper 2 · 4.5.4a

ASCII &
Unicode

Character encoding · Text representation · Section 4.5

WHAT YOU'LL LEARN
ASCII (7-bit, 128 chars) · Unicode (UTF-8/16/32) · Why Unicode needed · Code points
AQA SPEC LINK
4.5.4 — Text: ASCII, Unicode, UTF-8, UTF-16, UTF-32
ASCII

ASCII — American Standard Code for Information Interchange

ASCII uses 7 bits to encode characters, giving 2⁷ = 128 possible characters. Originally designed for English text.
CharDecimalBinary
A651000001
B661000010
a971100001
0480110000
SPACE320100000
Key fact: 'A' is 65, 'a' is 97 (32 difference). Digits 0–9 are 48–57.
ASCII Limitations

Why ASCII Wasn't Enough

Only 128 characters — covers basic English, digits, punctuation
No accented characters (é, ü, ñ) for other European languages
No support for Chinese, Arabic, Hindi, Japanese, Korean, etc.
No emoji — modern communication uses thousands of emoji
Extended ASCII (8-bit, 256 chars) helped but still insufficient for global use
Unicode

Unicode — Universal Character Standard

Unicode assigns a unique code point (U+XXXX) to every character in every language. Over 143,000 characters including all scripts, symbols, and emoji.
A = U+0041 (same as ASCII)
é = U+00E9
中 = U+4E2D
😊 = U+1F60A
Arabic ع = U+0639
UTF Encodings

UTF-8, UTF-16, UTF-32

UTF-8 (variable: 1–4 bytes per character)
ASCII characters use 1 byte (backward compatible). Most common on the web. Efficient for English text.
UTF-16 (2 or 4 bytes per character)
Used internally by Windows and Java. Good for CJK (Chinese/Japanese/Korean) text.
UTF-32 (fixed: 4 bytes per character)
Simple fixed-width. Uses most memory. Direct code point lookup.
UTF-8 Detail

Why UTF-8 is So Widely Used

Backward compatible with ASCII — all ASCII files are valid UTF-8
Variable width — common characters (A-Z, 0-9) use just 1 byte; rare characters use more
Space efficient for English text; over 90% of web pages use UTF-8
Self-synchronising — easy to find start of next character even if you start in the middle
Comparison

ASCII vs Unicode Comparison

FeatureASCIIUnicode (UTF-8)
Bits per char7 bits8–32 bits (variable)
Characters128143,000+
LanguagesEnglish onlyAll world scripts
EmojiNoYes
Memory useLessMore (for non-ASCII)
Text in Programs

Strings in Memory

Each character in a string is stored as its code point (e.g. ASCII or UTF-8 bytes)
"Hi" in ASCII: 72 (H), 105 (i) → stored as bytes 0x48 0x69
AQA pseudocode: ASC("A") returns 65; CHR(65) returns "A"
Case conversion trick: lowercase = uppercase code + 32 (e.g. 'A'=65, 'a'=97)
AQA Exam Style

Practice Question

AQA 7517 — Paper 2 Style
(a) ASCII uses 7 bits. State how many different characters ASCII can represent. [1]
(b) The ASCII code for 'R' is 82. What is the ASCII code for 'r'? Explain. [2]
(c) Give TWO reasons why Unicode was developed to replace ASCII. [2]
(d) State ONE advantage of UTF-8 over UTF-32 when storing English text. [1]
[6 marks]
1 mark
(a) 128 (2⁷)
2 marks
(b) 114. Lower case letters have codes 32 higher than their upper case equivalent (82 + 32 = 114)
2 marks
(c) ASCII only supports English / ASCII has only 128 characters, insufficient for international languages, emoji, special symbols
1 mark
(d) UTF-8 uses only 1 byte per ASCII character vs 4 bytes in UTF-32 — uses less storage for English text
Summary

Key Points to Remember

ASCII — 7-bit, 128 characters, English only. 'A'=65, 'a'=97, '0'=48
Unicode — code points for 143,000+ chars; covers all world languages + emoji
UTF-8 — variable width (1–4 bytes); backwards compatible with ASCII; most common
UTF-16 — 2 or 4 bytes; UTF-32 — fixed 4 bytes, simple but memory-heavy
Lowercase = uppercase + 32 in ASCII; use ASC() and CHR() in AQA pseudocode
🎉 Lesson complete — move to the quiz!