Unit 11.3A · Term 3

Text Representation: ASCII & Unicode

Computers store text as numbers. A character such as A, Ә or 中 is assigned a numerical code, and an encoding determines how that code is stored as bytes. This lesson compares ASCII and Unicode and shows how to calculate the storage required by a text fragment.

Learning Objectives

  • 11.1.1.7 Compare Unicode and ASCII
  • 11.1.1.8 Calculate the number of bytes required to store a text fragment

From Character to Binary

A character is mapped to a Unicode code point and then encoded into bytes
Characters are assigned codes; an encoding defines the bytes used to store those codes.
Character

A letter, digit, punctuation mark, symbol, emoji or other textual element.

Character set

A collection of characters with numerical codes assigned to them.

Encoding

A rule for converting character codes into bytes for storage or transmission.

Important terminology

Unicode defines characters and their code points. Encodings such as UTF-8, UTF-16 and UTF-32 specify how Unicode code points are represented as bytes.

ASCII

ASCII (American Standard Code for Information Interchange) is an early character set designed mainly for English-language text and control characters. Standard ASCII uses 7 bits, giving 2^7 = 128 possible codes.

Character Decimal ASCII 7-bit binary Stored in an 8-bit byte
A65100000101000001
a97110000101100001
048011000000110000
space32010000000100000

“Extended ASCII” is not one universal standard

Standard ASCII is the 7-bit, 128-code set. Many older systems used different 8-bit code pages for additional characters; these are often loosely called “extended ASCII”, but they are not one single universal character set.

Unicode

Comparison showing a small ASCII character set and Unicode examples including Kazakh, Chinese and emoji
Unicode is designed to represent characters from many writing systems and symbol sets.

Unicode assigns each supported character a unique code point, written in forms such as U+0041 for A or U+04D8 for Ә. The same Unicode text can then be encoded using UTF-8, UTF-16 or another Unicode encoding.

UTF-8 examples showing characters that use one, two, three or four bytes
UTF-8 is variable-length: different characters may use different numbers of bytes.

ASCII compatibility

Standard ASCII characters are included in Unicode. In UTF-8, the first 128 code points use the same byte values as ASCII, so ordinary ASCII text is automatically valid UTF-8.

ASCII vs Unicode

Feature ASCII Unicode
Character coverage Small set; mainly English letters, digits, punctuation and control characters Designed for characters from many writing systems, symbols and emoji
Standard size idea 7-bit standard ASCII: 128 codes Much larger code space
Storage Commonly stored as one byte per ASCII character Depends on the Unicode encoding and the character
Compatibility ASCII is limited but simple Includes all standard ASCII characters
Example limitation / strength Cannot directly represent characters such as Ә, 中 or 🙂 Can assign code points to these characters

Exam-style comparison answer

Difference 1: ASCII has a much smaller character set, while Unicode supports characters from many languages and symbol systems.

Difference 2: ASCII has a fixed 7-bit standard code set and is commonly stored in one byte per character, while Unicode can use encodings such as UTF-8 or UTF-16 that may require multiple bytes for some characters.

Calculating Text Storage

Comparison of fixed-width text size calculation and variable-width UTF-8 calculation
The correct method depends on the encoding assumptions in the question.

Case 1 — Fixed number of bits per character

size in bits = number of characters × bits per character size in bytes = size in bits ÷ 8

1 250 characters at 8 bits per character

250 × 8 = 2000 bits 2000 ÷ 8 = 250 bytes

2 120 characters at 16 bits per character

120 × 16 = 1920 bits 1920 ÷ 8 = 240 bytes

Case 2 — UTF-8 variable-length text

3 AӘ中🙂 in UTF-8

A → 1 byte Ә → 2 bytes 中 → 3 bytes 🙂 → 4 bytes Total = 1 + 2 + 3 + 4 = 10 bytes

Exam rule

Do not invent a fixed “Unicode bytes per character” value. Use the encoding and bit/byte information stated in the question. If the question uses a simplified model such as “16 bits per character”, calculate with that model.

Character count alone may not determine UTF-8 size

Four ASCII characters need 4 bytes in UTF-8, but four non-ASCII characters can require more. You need to know the actual characters or their byte lengths.

Interactive Labs

1. ASCII or Unicode?

Decide whether the character can be represented.

2. Fixed-Width Text Size Calculator

Calculate storage when a question gives a fixed number of bits per character.
characters × bits per character ÷ 8

3. UTF-8 Byte Inspector

Enter text to see how many UTF-8 bytes it requires.
UTF-8 uses 1–4 bytes for individual Unicode code points.

4. Storage Reasoning

Choose the best answer.

Common Pitfalls

“Unicode = 16 bits per character”

This is not generally correct. Unicode is a character standard; encodings such as UTF-8 and UTF-16 determine the stored bytes.

“ASCII = only letters”

ASCII also contains digits, punctuation, control characters and symbols.

Forgetting bits → bytes

If a calculation produces bits, divide by 8 to obtain bytes.

Counting characters but ignoring the encoding

For variable-length encodings such as UTF-8, different characters can use different numbers of bytes.

Graded Tasks

Remember

State what ASCII stands for and how many codes are available in standard 7-bit ASCII.

Understand

Explain two differences between ASCII and Unicode.

Understand

Explain the difference between a Unicode code point and a Unicode encoding such as UTF-8.

Apply

A text fragment contains 450 characters stored at 8 bits per character. Calculate its size in bytes.

Apply

A text fragment contains 300 characters stored at 16 bits per character. Calculate its size in bytes.

Analyze

Explain why the same number of characters can require different amounts of storage in UTF-8.

Apply

Using the byte lengths A = 1, Ә = 2, 中 = 3 and 🙂 = 4, calculate the UTF-8 size of AӘ中🙂A.

Analyze

A school needs to store Kazakh, English and emoji in student messages. Justify why Unicode is more suitable than ASCII.

Exam Practice

Q1: State two differences between ASCII and Unicode. [2]

Reveal marking points
Any two valid differences, 1 mark each: ASCII has a much smaller character set than Unicode; Unicode supports characters from many writing systems / symbols / emoji; standard ASCII uses a 7-bit code set while Unicode can be encoded using variable/multiple bytes; ASCII characters are included within Unicode.

Q2: A text fragment contains 180 characters. It is stored using 8 bits per character. Calculate the storage required in bytes. [2]

Reveal marking points
180 × 8 = 1440 bits [1]. 1440 ÷ 8 = 180 bytes [1].

Q3: A system stores 75 characters using 16 bits per character. Calculate the size in bytes. [2]

Reveal marking points
75 × 16 = 1200 bits [1]. 1200 ÷ 8 = 150 bytes [1].

Q4: Explain why the number of characters alone may be insufficient to calculate the size of a Unicode text fragment stored using UTF-8. [2]

Reveal marking points
UTF-8 is a variable-length encoding [1]. Different characters may require different numbers of bytes, so the actual characters / byte lengths are needed [1].

Self-Check Quiz

Eight quick checks Click each answer to reveal
1. How many codes can 7-bit ASCII represent?
Click to reveal answer
2. Can standard ASCII directly represent the character Ә?
Click to reveal answer
3. What is a Unicode code point?
Click to reveal answer
4. Name one Unicode encoding.
Click to reveal answer
5. How many bytes are required for 100 characters at 8 bits per character?
Click to reveal answer
6. How many bytes are required for 100 characters at 16 bits per character?
Click to reveal answer
7. Is UTF-8 fixed-width?
Click to reveal answer
8. Why is Unicode more suitable for multilingual text than ASCII?
Click to reveal answer