Character Sets - ASCII and Unicode
A character set is all of the characters that a computer can display*. All forms of data are stored inside the computer as numbers, and that includes text. Each character (or symbol) is represented by its own numeric code. The two character sets you need to know about for GCSE Computer Science are ASCII (American Standard Code for Information Interchange) and or Unicode.
- ASCII is the older standard and contains the most common characters - e.g. the ones that you might type using the keyboard. ASCII is a seven-bit code (see below if you are doing the OCR GCSE), so can represent 128 different characters.
- different countries might use different symbols, e.g. accented letters or currency symbols, so extended ASCII was introduced. This uses an extra bit to double the number of available codes. OCR doesn't distinguish between ASCII and extended ASCII, and describes ASCII as an eight-bit code (i.e. it's really extended ASCII) - which makes file-size calculations more straighforward.
- Unicode uses up to 32-bit/4-bytes and can therefore represent in the region of four billion different symbols - it can be used for different languages, emojis, sub- and super-script characters, die faces and playing cards, etc.
- the first 128 characters are the same in both ASCII and Unicode, e.g. A is 65 in both.
Note that you aren't required to know any of the individual codes for your GCSE exam, but you are expected to know that they are in alphabetic order - you are commonly given the code for one letter and asked for another, e.g. if A is 65, then what is C?
To see characters with higher codes, change the range of the slider using the offset below:
Notice that upper and lower case letters have different codes. Some Unicode characters are multi-coloured (look in the range 9-10,000). Note that not all characters are visible - there are things like spaces, carriage returns and line feeds that are invisible on a web-page. Not all Unicode values are assignment to characters, which is why there are gaps in the list of offsets. For ease of programming, only 16 bits are used for character codes in this example.
Although text files tend to be relatively small (compared with sounds and images, for example), you can still use compression techniques to make the file smaller.
* the instruction set is a similar idea, it's the set of instructions that a processor can execute.