Skip to content
This repository has been archived by the owner on Jul 23, 2019. It is now read-only.

What should shortnameToUnicode(':heart:') return? #597

Open
chrisdeeming opened this issue Jun 23, 2018 · 2 comments
Open

What should shortnameToUnicode(':heart:') return? #597

chrisdeeming opened this issue Jun 23, 2018 · 2 comments

Comments

@chrisdeeming
Copy link

The demo here when you enter :heart: produces:

image

Whereas I'd expect it to produce (I modified the page source to get it to display correctly for example purposes):

image

I've tested on most browsers and OS' and it seems to be mostly all of them that produce the same output, leading me to the conclusion that the library itself is returning the wrong value.

Anyone experiencing a similar thing?

@JoshyPHP
Copy link
Contributor

JoshyPHP commented Jun 23, 2018

I'm going to sum it up because it's hard to understand what's going on based on screenshots.

  • emojione.shortnameToUnicode(':heart:') returns "\u2764"
  • UnicodeData defines U+2764 as "HEAVY BLACK HEART"
  • As per Emoji data for Unicode 11.0, U+2764 does not have the property Emoji_Presentation.
  • TR51 suggests that "plain web pages" display characters that do not have the Emoji_Presentation property as text rather than images unless they are followed by U+FE0F, AKA variation selector 16 . Therefore, browsers display "\u2764" as text and "\u2764\uFE0F" as an image.
  • If shortnameToUnicode()'s purpose is to display images then emojione.shortnameToUnicode(':heart:') should return "\u2764\uFE0F".

@chrisdeeming
Copy link
Author

Very well worded, @JoshyPHP.

I actually was thinking in a similar direction before I created this issue, but my eyes scanned the RuleSet definition for :heart and I read '2764-fe0f' in its array and thought it was that which was being returned in this conversion, but I see now it is actually '2764'.

So, spot on 👍

Unfortunately, it appears as though most of the heart ones may be outputting incorrectly.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants