Computational Linguistics 1, Exercise 1: code points and bytes Code (run with py -X utf8): for ch in ["n", "ñ", "€", "😀"]: print(ch, "U+%04X" % ord(ch), len(ch.encode("utf-8"))) Output from the run: n U+006E 1 ñ U+00F1 2 € U+20AC 3 😀 U+1F600 4 Pattern: the larger the code point, the more bytes UTF-8 needs. Here "n" (ASCII range) takes 1 byte, "ñ" 2, "€" 3, and the emoji (a supplementary-plane code point) 4, matching the Unicode article's statement that supplementary-plane code points take four bytes in UTF-8. (The article says Basic Multilingual Plane code points take one to three bytes; the exact thresholds are not in the part of the article I read, so I only claim the pattern shown by these four.)