4.4 - Character Sets: ASCII & Unicode
What characters are and why they need binary representation
Characters form the building blocks of text in computing, allowing us to create words, sentences, and other written content. They include uppercase letters (like A, B, C), lowercase letters (like a, b, c), digits from 0 to 9, and symbols such as ?, +, and £. Computers, however, can only process data in binary form, which consists of 0s and 1s. This means characters cannot be handled directly by a computer's hardware. Instead, each character must be converted into a unique binary code that the computer can understand and store.
This conversion allows computers to handle text. When a key is pressed, the computer receives a binary signal, translating it into the correct character for display or storage. Special characters also exist, which trigger actions rather than displaying visible symbols – for example, the tab key creates horizontal space, and the enter key starts a new line.
The role of character sets in computing
A character set is a predefined collection of characters that a computer can recognise and process, each linked to a specific binary code. This acts like a translation guide: when the computer receives a binary code from input (such as a keyboard press), it looks up the corresponding character in the set and displays or uses it accordingly.
Key features of character sets
- Inclusion of special characters - Beyond letters and symbols, sets include codes for actions like backspace or line breaks.
- Capacity limits - The number of characters a set can represent depends on the length of its binary codes; longer codes allow for more characters.
Difference between character sets and fonts
While character sets and fonts both relate to how text appears, they serve distinct purposes in computing.
Character sets
- Determine which specific character is used based on the binary code.
- Focus on the underlying representation and recognition of text.
Fonts
- Control the visual style and appearance of characters, such as their shape, size, or boldness.
- Do not change the actual character but only how it is displayed.
Main types of character sets
Different character sets have evolved to meet varying needs, especially for supporting multiple languages and symbols. The choice of set affects how many characters can be represented and which languages are supported. Sets with longer binary codes can handle more characters, making them suitable for global use.
ASCII character set
ASCII (American Standard Code for Information Interchange) is the most common character set for English-language users. It uses 7-bit binary codes, which can represent up to 128 characters. To fit standard byte sizes, a leading 0 is often added, making each code 8 bits (1 byte) long.
Examples of ASCII characters:
| Character | Binary | Decimal |
|---|---|---|
| Backspace | 0000 1000 | 8 |
| + | 0010 1011 | 43 |
| 3 | 0011 0011 | 51 |
| B | 0100 0010 | 66 |
| b | 0110 0010 | 98 |
Extended ASCII character set
Extended ASCII builds on the original ASCII by using full 8-bit binary codes, allowing for up to 256 characters. The first 128 characters match ASCII exactly, with the additional 128 providing extra symbols.
A key advantage is that it includes characters with accents, such as é and ü, making it suitable for many European languages.
Unicode character set
Unicode is designed to represent characters from all major world languages, making it far more extensive than ASCII or extended ASCII. It can use up to 32 bits per character.