Menu

Character Sets

Unicode

Unicode is a character set built to cover characters from many written languages, plus symbols such as currency signs, maths signs and emoji. It exists because a small character set like ASCII simply runs out of room.

Standard ASCII uses 7 bits for each character, so it has only 128 different codes. Plenty of languages need letters ASCII never included: the Welsh ŵ, the French é, the Greek λ, the Hindi अ. A character set that holds more characters than there are available codes cannot be fully represented: once every bit pattern has been used, the extra characters have nowhere to go and are lost or replaced by a substitute symbol.

More bits, more room

The size of a character set is limited by the number of unique codes its bits can make. Add a bit and you double the number of unique codes, so twice as many characters can be represented: moving from 7 bits to 8 bits takes you from 128 codes to 256. Unicode uses more bits per character than ASCII (often 16 or 32), which gives it a code space big enough for more than 100,000 characters — far more than any single alphabet needs.

For example, a travel blog about Iceland wants to name Þingvellir, a national park. The letter Þ has no code in 7-bit ASCII, so the page can only be stored and displayed correctly if the file uses Unicode, where that letter does have its own code. Saving it as plain ASCII would leave the name with a missing or wrong character.

Unicode gives characters codes that go far beyond the ASCII range: the Greek capital omega is 937, not one of ASCII's 128 codes.

Practise this