janlelis / unicode-emoji

Up-to-date Emoji Regex in Ruby 💥
https://character.construction/emoji
MIT License
147 stars 14 forks source link

Seems like 🫶 might not be supported? #13

Closed fakeharxy closed 2 years ago

fakeharxy commented 2 years ago

We seemed to have an issue with the above emoji not being caught by the gem regex? I don't really know how to debug further, but I can say that this doesn't seem to be working correctly?

image

Happy to try and debug further in any way I can help? Let me know,

Many thanks.

janlelis commented 2 years ago

Hi. I've just checked and it does return the correct code point (U+1FAF6). When you try to print/puts it, you'll see the HEART HANDS emoji. However, the Ruby language itself does not recognize it and thinks it is an unknown code point.

Please note that Ruby's own Emoji support is at Unicode 13 (see https://idiosyncratic-ruby.com/73-unicode-version-mapping.html) The HEART HANDS emoji was introduced in Unicode 14 (https://emojipedia.org/heart-hands/)

You can still use this gem with these recent emoji - the regex works fine

fakeharxy commented 2 years ago

Ah ok... we are using it in this fashion (pseudo-ey)

string.delete(^Emoji::Regex)

To delete anything from the string that isn't a registered emoji. I guess this isn't working on 🫶 because string.delete doesn't recognise the unicode as that emoji.

Ok, thanks for the help understanding the issue.

janlelis commented 2 years ago

@fakeharxy This should work, if not, it would be a bug in this library. You can achieve that like this:

1🫶2🫶3".scan(Unicode::Emoji::REGEX).join   #=> "\u{1FAF6}\u{1FAF6}"