The farmer emoji (👩🏾‍🌾) is a bit of a mystery.

PHP's strlen function says that its length is 15. mb_strlen gives a length of 4 (depending on how PHP is configured). The grapheme_strlen function returns a length of 1.

Why do all these functions disagree? And there's just one emoji there...shouldn't they all have the same length: 1?

To understand this madness, you need to understand a little about Unicode. Many developers, myself included, get intimidated by Unicode. What's "UTF-8"? What's a "code point"? What does "U+1F937" mean?

In this talk, I'll try to answer these questions so that the next time someone gets confused by the length of the farmer emoji, you can help.

Comments

Comments are closed.