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

Support Japanese button emojis (such as ㊗️) #31

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

MugiSus
Copy link

@MugiSus MugiSus commented Jan 27, 2023

0x3297 0xFE0F

EN

Note that even most browsing apps cannot display ㊗️ 0x3297 0xFE0F and ㊗ 0x3297 correctly.

Expected behavior:

splitGraphemes('㊗️') // ['㊗️']
splitGraphemes("㊗️㊙️🈂️🈚️🈯️🈷️") // ["㊗️", "㊙️", "🈂️", "🈚️", "🈯️", "🈷️"]

Actual behavior:

splitGraphemes('㊗️') // ['㊗', '️'(0xFE0F Emoji Variation Sequence)]
splitGraphemes("㊗️㊙️🈂️🈚️🈯️🈷️") // ["㊗", "️", "㊙", "️", "🈂", "️", "🈚", "️", "🈯", "️", "🈷", "️"]

㊗, ㊙ are included in Unicode 0x3200-0x32FF Enclosed CJK Letters and Months, and 🈂, 🈚, 🈯, 🈷 are included in Unicode 0x1F200-0x1F2FF Enclosed Ideographic Supplement, so I added the range 0x3200-0x32FF and 0x1F200-0x1F2FF to the emojiRange array in src/emoji.js.

const emojiRange = [
  '[\\u{2600}-\\u{26FF}]', // Miscellaneous Symbols
  ...
  '[\\u{3200}-\\u{32FF}]', // Enclosed CJK Letters and Months
  '[\\u{1F200}-\\u{1F2FF}]', // Enclosed Ideographic Supplement
  ...
  '[\\u{1F900}-\\u{1F9FF}]' // Supplemental Symbols and Pictographs
]

P.S.

I noticed same issue also happens on some of these emoji (Unicode.org emoji-varians) which would be incorrectly splitted into a plain symbol and 0xFE0F, so I assume there is a lot more things to do, but maybe not in this PR.

JP

赤丸に白文字で㊗️の絵文字が「㊗0x3297」と「絵文字バリエーションシーケンス0xFE0F」に分割されてしまっていたので、㊗, ㊙ を含むEnclosed CJK Letters and Monthsと同様の問題に遭遇している 🈂, 🈚, 🈯, 🈷 を含むEnclosed Ideographic Supplementsrc/emoji.jsemojiRangeに追加しました。

@MugiSus MugiSus changed the title support more variable Japanese emojis (such as ㊗️) support Japanese button emojis (such as ㊗️) Jan 27, 2023
@MugiSus MugiSus changed the title support Japanese button emojis (such as ㊗️) Support Japanese button emojis (such as ㊗️) Jan 27, 2023
@yuiseki yuiseki requested review from daiiz and shokai January 27, 2023 07:52
@daiiz
Copy link
Member

daiiz commented Jan 27, 2023

すごい! ありがとうございます。
以下2点、対応できそうでしたらお願いします。

  • packge-lock.jsonをdiffに含めない
  • 0xFE0Fを使わない場合にも正しく1文字として区切られることのテストを追加

add 'uFE0F without emoji variation sequence' section
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants