Wirebook › Bonus lesson
Why do emojis turn into boxes, question marks or gibberish?
You send a friend a pizza emoji and they see a little empty box. Or a string of strange letters like ðŸ•. Or a family that has fallen apart into three separate people. Did someone steal your emojis? Put on your detective hat: this lesson shows what an emoji really is (a number, not a picture) and solves four crime scenes where emojis seemed to vanish.
An emoji is a number with a name
Computers only store numbers, so every letter, digit and emoji in the world has been given its own number by a club called the Unicode Consortium. Capital A is number 65 (written U+0041). The pizza is number 127,829 (U+1F355). When you send a pizza, your phone doesn't send a picture: it sends that number, packed into four bytes using a code book called UTF-8.
Your friend's phone then looks the number up in its own emoji font and draws its own picture. That's why the same emoji looks a bit different on different phones: each company has its own artists. It also means the picture can go wrong at the far end, even though the number arrived perfectly.
Some emojis are several numbers stuck together. A thumbs up with a skin tone is the thumbs-up number plus a skin-tone number. A family is a man, a woman and a girl joined by invisible zero width joiners: glue characters that say "draw these as one picture if you can". Flags are two special letters (G and B make 🇬🇧).
The four usual suspects
- A missing picture (the "tofu" box). New emojis are added every year. An older phone that hasn't been updated knows the number but has no drawing for it, so it shows an empty box, nicknamed tofu. Updating the phone usually fixes it.
- The wrong code book (mojibake). If a program reads UTF-8 bytes as if they were an old Western code book, each byte becomes its own letter, and a pizza turns into gibberish like
ðŸ•. The Japanese word for this is mojibake, "changed characters". The bytes are all still there, so reading them with the right code book brings the emoji back. - Glue that didn't stick. A device that doesn't know a joined-up emoji draws the pieces one by one: 👨👩👧 instead of a family, or a person next to a laptop instead of a coder. Nothing is lost; it's just not glued.
- A box that's too small. Some older systems could only store characters up to three bytes long. Most emojis need four, so they got squashed into
?when saved. This is the only suspect that really destroys the emoji.
Keeping your emojis safe
- If a friend sees boxes, their phone or app probably needs an update.
- If you see
ðŸ-style gibberish in an email or a web page, the program picked the wrong code book. Websites avoid this by saying<meta charset="utf-8">at the top of every page, like this one does. - Builders of apps: store text as UTF-8 with room for four-byte characters (in MySQL that's
utf8mb4, not the oldutf8). - Your spam filter didn't eat your emojis. Spam filters move whole messages to a junk folder; they don't nibble single characters out.
Related: why one emoji can turn a single text into two (in the text-message lesson).