Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: emoji name is not getting rendered correctly for emojis with skin tone modifers #16119

Merged
merged 2 commits into from
Oct 27, 2023

Conversation

arjita-mitra
Copy link
Contributor

Description

In the latest version of emoji-picker library a new version of emoji.json file got added. In this json file the unicode object called "u" has the emoji unicode without the skintone modifiers. if the emoji has skin tone modifiers then its part of another object property called "v".

Example:

This is the emoji object of a boy emoji-
{ "n": [ "boy" ], "u": "1f466", "v": [ "1f466-1f3fb", "1f466-1f3fc", "1f466-1f3fd", "1f466-1f3fe", "1f466-1f3ff" ], "a": "0.6" }

As you can see the unicode object property "u" has the emoji unicode, the "v" property holds the unicode with skin modifier. But not all emoji has skin modifiers so we need to use the actual emoji unicode value as our unicode key. When a skin tone modifier emoji comes like hand emojis then we need to discard the skin modifier part of the unicode and take the rest of it and compare the unicode value with our emoji dictionary to fetch the emoji title/name. So suppose receive 1f466-1f3fb then we need to discard the 1f3fb part of it and compare only 1f466 with the emoji dictionary. The skin modifier can be any part of the unicode not just at the end, but they are fixed value set one of 1f3fb/1f3fc/1f3fd/1f3fe/1f3ff

Another fix I have done is, don't replace a hyphen from the emoji title with space if its followed by a numeric character. This is fixed the issue of thumbs down emoji title which is -1 and was displayed as 1 now its -1.

Screenshots/Screencast (for UI changes)

BEFORE

Screenshot 2023-10-27 at 11 42 08

AFTER

Screenshot 2023-10-27 at 11 42 31 Screenshot 2023-10-27 at 11 42 35

Checklist

  • PR has been self reviewed by the author;
  • Hard-to-understand areas of the code have been commented;
  • If it is a core feature, unit tests have been added;

@codecov
Copy link

codecov bot commented Oct 27, 2023

Codecov Report

Merging #16119 (f610575) into dev (1eda3a5) will increase coverage by 44.55%.
The diff coverage is 30.76%.

@@           Coverage Diff            @@
##           dev   #16119       +/-   ##
========================================
+ Coverage     0   44.55%   +44.55%     
========================================
  Files        0      708      +708     
  Lines        0    23146    +23146     
  Branches     0     5258     +5258     
========================================
+ Hits         0    10312    +10312     
- Misses       0    11495    +11495     
- Partials     0     1339     +1339     

@arjita-mitra arjita-mitra merged commit a92e699 into dev Oct 27, 2023
12 checks passed
@arjita-mitra arjita-mitra deleted the bugfix/skintone-emoji-name branch October 27, 2023 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants