Encode a character as bytes — quick review
Imagine a coat check.
Capital A has code point U+0041. Its UTF-8 byte is 41. Lowercase é has code point U+00E9. It uses two UTF-8 bytes, C3 first and A9 second.
A base letter followed by a separate combining accent can use two code points, one for the letter and one for the accent. Together they form a combining sequence. Use the single code point U+00E9 for each é in this lesson's inputs.
Use UTF-8. Start with an empty row and a byte count of zero. Write one box per byte and two hex digits per box.
Read the input from left to right. For each letter, find its code point in The rule. Add that code point's bytes to the right of the row in the order shown.
Stop once you have written the bytes for the last letter. Read the finished row left to right and count the boxes.
A character count alone leaves the UTF-8 byte count open. AA and Aé each have two letters here. AA takes two bytes, and Aé takes three. Work out how many bytes each code point adds before counting the total.