Why does the red heart emoji require two code points, but the other colored hearts require one?

后端 未结 2 2038
北恋
北恋 2021-01-31 01:19

It appears that the red heart emoji (❤️) \"\\u2764\\uFE0F\" requires two Unicode codepoints, specifically Heavy Black Heart followed by a Variation Selector. However, blue

2条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-31 01:55

    HEAVY BLACK HEART was added to Unicode decades before emoji. When emoji were incorporated in Unicode 6 some already existing characters were simply reused as emoji to avoid unnecessary duplicates. Later, variation sequences were defined for characters that also map to a non-emoji character set to allow for better control over how they display. For example, U+2744 ❄ SNOWFLAKE is originally from Zapf Dingbats (I believe) but was later also made an emoji. So if you want to force the original text-style display you can use VARIATION SELECTOR-15 (resulting in ❄︎), and if you want to force the newer emoji-style display you can use VARIATION SELECTOR-16 (resulting in ❄️).

    Note, however, that not many platforms actually support those variation sequences correctly at the moment. Also not all of them automatically apply the variation selectors when using the emoji keyboard. In theory ❤ and ❄ (and many other emoji) should display as text style by default without VS16, but many applications ignore that as well.

    I have a list of all code points that can display differently via a variation sequence, on my website, if you're interested. The next Unicode update in June is going to add some more.

提交回复
热议问题