Emoji look simple, but under the hood each one is a Unicode code point, or a sequence of them. 😀 is U+1F600, which you can write in HTML as 😀 or 😀. Skin tones, gender variants and flags are built by joining several code points, often with a zero-width joiner (U+200D). That's why 👩💻 counts as more than one "character" in JavaScript's .length.
A few practical tips:
- Use
Array.from(str).lengthorIntl.Segmenterto count emoji correctly. - Always serve pages as UTF-8, and store text in a
utf8mb4column in MySQL. - Expect the same emoji to look different on Apple, Google and Microsoft, so check that the meaning still comes across on every platform.
When I need a code point, an HTML entity or a quick side-by-side of vendor designs, I use EmojiCenter. It lists 3,664+ emoji with their meanings and codes, and it has copy-paste sets for TikTok, REDnote, WeChat and Douyin.
Top comments (0)