Unicode supports over a million characters. Each character is assigned a number, called
a code point. In Python, code points are written in the form \uXXXX, where XXXX
is the number in four-digit hexadecimal form.
Within a program, we can manipulate Unicode strings just like normal strings. How
ever, when Unicode characters are stored in files or displayed on a terminal, they must
be encoded as a stream of bytes. Some encodings (such as ASCII and Latin-2) use a
single byte per code point, so they can support only a small subset of Unicode, enough
for a single language. Other encodings (such as UTF-8) use multiple bytes and can
represent the full range of Unicode characters.
Text in files will be in a particular encoding, so we need some mechanism for translating
it into Unicode—translation into Unicode is called decoding. Conversely, to write out
Unicode to a file or a terminal, we first need to translate it into a suitable encoding—
this translation out of Unicode is called encoding. From a Unicode perspective, characters are abstract entities that can be realized as one
or more glyphs. Only glyphs can appear on a screen or be printed on paper. A font is
a mapping from characters to glyphs.
