3.3.5 - ASCII and Unicode character encoding
Use encoding tables to convert characters and numerical codes, infer codes within sequential groups, and explain how Unicode supports more characters than seven-bit ASCII.
Character sets and encoding tables
A computer represents a character by storing the numerical code assigned to it in an agreed character set.
Character set
A defined collection of characters, with a code assigned to each character so text can be represented digitally.
Seven-bit ASCII has codes, numbered 0–127. These include letters, digits, punctuation and control characters. A character encoding table tells you which character a code represents. Some systems store ASCII in eight-bit bytes, but standard seven-bit ASCII still defines 128 codes; an eighth storage bit does not change that definition.
Use this supplied fragment of the ASCII table:
| Character | space | ! | 0 | 1 | 2 | A | B | C | a | b | c |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Decimal code | 32 | 33 | 48 | 49 | 50 | 65 | 66 | 67 | 97 | 98 | 99 |
The text A1! becomes the codes 65, 49, 33. The code sequence 66, 32, 50 becomes B followed by a space followed by 2. To store the codes in binary, convert each numerical code using place values. The code for A is decimal 65, or seven-bit 1000001.
Notice that the character “1” has code 49; it is not the numerical value 1. Text and numbers use different interpretations of the stored bits.
Sequential groups of codes
Within an encoding table, related characters often have consecutive codes, so one known code lets you calculate others in the same group.
The uppercase ASCII letters begin at A = 65. B is 66 and C is 67. F is five positions after A, so its code is . To decode 74, find the difference ; nine positions after A is J. Count A as offset zero, not offset one.
Lowercase letters form their own group beginning at a = 97. Therefore d = . The digit characters begin at 0 = 48, so the code for “7” is . Each group follows a sequence, but the groups are not all adjacent: you cannot assume that lowercase a immediately follows uppercase Z.
Continue this lesson.
You’re previewing NovaLearn without an account. Create a free account to read the rest.
Create free account