Character Assembler — Web Fundamentals

Assemble the UTF-8 bytes for each character, from ASCII to emoji: 18 levels of code points, multibyte bits and surrogate pairs.

What you learn in this game

A computer keeps no letters, only numbers. Every letter has a number: B is number 66, z is number 122. At Mr. Piksel's press, that number is carved into wooden blocks, and one block holds numbers up to 127. The press then reads the blocks with a dictionary, the way a browser reads a page.

Letters with marks, like é, ñ and ü, have numbers above 127, so they don't fit in one block. UTF-8, the dictionary the web uses today, splits the number across two blocks. Two blocks hold numbers up to 2,047.

Blocks hold only numbers. What turns numbers into letters is a dictionary (an encoding). The UTF-8 dictionary knows that two blocks can make one letter. The old dictionary on the internet café's PC reads every block as a letter of its own, so a two-block letter prints as two odd letters. In HTML, the dictionary is named at the top: <meta charset="utf-8">.

Chinese, Japanese, Korean and Hindi letters, and many signs, have numbers above 2,047. UTF-8 gives them three blocks. Three blocks hold numbers up to 65,535.

Most emoji have numbers above 65,535, so even three blocks are not enough. UTF-8 uses four blocks, which hold numbers up to 1,114,111. No letter needs more than four.

Some emoji are made of several numbers. A skin colour is a number of its own that sticks to the picture before it, and the browser draws the two as one. Each number still needs its own blocks.

What the levels ask

  1. Pick each letter's blocks, then print.
  2. Pick the blocks for é, then print.
  3. Pick the blocks for ñ and the press's dictionary, then print.
  4. Pick the blocks for 中 and the dictionary, then print.
  5. Pick the blocks for the smiling face and the dictionary, then print.
  6. Count the odd letters in her printout, pick the blocks for ✓ and the dictionary, then print.
  7. Pick the press's dictionary, then print.
  8. Pick the blocks for ☃ and the dictionary, then print.
  9. Pick the blocks for the thumb and for its colour, pick the dictionary, then print.
  10. Pick the byte count, then set the payload bits until they match the order's code point.
  11. Pick 2 bytes: 110xxxxx 10xxxxxx (11 payload bits).
  12. Ω needs 10 bits; the leftmost payload slot stays 0.

And more, 18 levels in all.