Character Sets
What Is a Character Set?
A character set is a defined list of characters (letters, digits, symbols, punctuation) where each character is assigned a unique binary number. Computers use these codes to store and transmit text.
Organisation
Characters are grouped in sequences within most character sets:
- Digits:
0-9 - Uppercase letters:
A-Z - Lowercase letters:
a-z - Special characters and symbols
If you know the code for one character, you can often work out adjacent characters. For example, if A = 65, then B = 66, C = 67 … and M = 77.
ASCII
ASCII (American Standard Code for Information Interchange) is the most well-known character set.
| Property | Value |
|---|---|
| Bits per character | 7 bits |
| Number of characters | 2⁷ = 128 |
| Includes | Upper/lowercase letters, digits 0-9, punctuation, control characters |
Extended ASCII extends this to 8 bits:
| Property | Value |
|---|---|
| Bits per character | 8 bits |
| Number of characters | 2⁸ = 256 |
| Extra characters | Accented letters, currency symbols, box-drawing characters |
File size of ASCII text:
- 1 character = 1 byte (8 bits in Extended ASCII)
- 100 characters at Extended ASCII = 100 bytes
Unicode
ASCII only covers English. Unicode was created to represent characters from all the world’s writing systems.
| Encoding | Bits | Unique Characters |
|---|---|---|
| UTF-8 | 8 bits (variable, up to 32) | 1,112,064 |
| UTF-16 | 16 bits (variable) | 2¹⁶ = 65,536 base |
| UTF-32 | 32 bits | 2³² possible |
Unicode and ASCII
UTF-8 is backwards-compatible with ASCII, the first 128 UTF-8 characters are identical to ASCII. This allows older ASCII text to be read correctly by Unicode systems.
Why Use Hexadecimal for Character Codes?
Large character sets like Unicode have code points that are long in binary. Hexadecimal provides a compact representation. For example:
- Unicode character U+1F600 (😀) =
11111011000000000in binary =1F600in hex, far more readable.
Exam Questions
Q: What is a character set?
A defined list of characters where each character is assigned a unique binary number, allowing computers to store and interpret text.
Q: What is the difference between ASCII and Unicode?
ASCII is a 7-bit set with 128 characters, covering only English text. Unicode is a much larger standard supporting characters from all writing systems worldwide, with encodings like UTF-8 (8-bit variable) and UTF-16 (16-bit variable).
Q: If capital A is 65 and capital C is 67, what is capital M?
The alphabet is sequential in ASCII. M is the 13th letter; A is the 1st. So M = 65 + 12 = 77.
Q: What is the file size of a 100-character text file encoded in Extended ASCII?
Extended ASCII uses 8 bits (1 byte) per character. 100 characters × 1 byte = 100 bytes.
Exam Tip
ASCII characters are sequential, adjacent characters differ by 1 in their code. If given one code value, you can derive nearby ones by addition or subtraction.