Chapter 1: The machine

Text encoding

Also called UTF-8, Unicode, Mojibake

The rule for turning characters into bytes and back. UTF-8 is the usual one today: English letters take one byte, é takes two and 日 takes three. Read with the wrong rule, the same bytes come out as garbage, such as café for café.

Agents tend to test with plain English, so these bugs wait for your first customer called José. Bytes and characters also differ, so a limit of 100 bytes can cut a character in half. Ask for a test with accents in it.

Say it to your agent

“Add a test that stores and reads back the name José Ñandú 日本 through the whole path: form, API, database and page. Set the database and the HTTP charset to UTF-8, and show me that it comes back identical.”

The workshop

Name a word, or describe what you mean in everyday language.