Track 7 · Lesson 10 of 11
Unicode and encodings
Understand characters as Unicode code points, convert between text and bytes with UTF-8, and compare text reliably with normalisation and case-folding.
You will be able to
- Explain the difference between a character, its code point and its bytes, using ord(), chr() and unicodedata.name()
- Encode text to bytes and decode bytes to text with UTF-8, and handle encoding errors deliberately
- Explain why len() of a string and of its bytes differ for accented letters and Arabic
- Normalise text with unicodedata.normalize() so that visually identical strings compare equal, and strip accents or Arabic diacritics for searching
- Compare text case-insensitively across languages with casefold()
Included with a Formula Quest membership
It has 4 graded exercises with feedback, hints and solutions. Python Quest is included in Formula Quest memberships that cover Python; membership and billing are managed on Formula Quest.
View Formula Quest memberships
Tracks 1 and 2, the first lesson of every track, the playground and the dataset library are free.