Cepler Light
Cepler Light

Reputation: 61

Why does the emoji ☘️ sometimes look like ☘?

I tried to identify an emoji in a text file. It looks like this: ☘️. But when I tried parsing the file for ☘️, I couldn't find it. As it turns out, I can only identify this emoji when I am instead looking for ☘.

In case your browser renders them differently, here is a screen-shot of the two emojis side by side: enter image description here

How can I automatically convert the first emoji (☘️) into the second (☘)? I am not sure if or how that would possible since they should already be the same.

Upvotes: 0

Views: 413

Answers (1)

Mark Ransom
Mark Ransom

Reputation: 308412

So much information in the comments, yet nobody's written it all into an answer.

Your first emoji is actually a combination of two different Unicode codepoints, U+2618 SHAMROCK and U+FE0F VARIATION SELECTOR-16. The second acts as a modifier to the first, converting it to a color rendering if all the parts of your display chain support it. Some don't, my Chrome browser on Windows shows the two emoji identically.

The second emoji is just the single codepoint U+2618 without a modifier.

To convert all occurrences of the first to the second with Python is trivial:

s = s.replace('\u2618\ufe0f', '\u2618')

Upvotes: 3

Related Questions