Giter Site home page Giter Site logo

Comments (4)

jcubic avatar jcubic commented on August 25, 2024

I think it's a bug because unicode without variation selector is just text and if there is variation selector after it should be rendered as image and only then it should be match as emoji.

I have another issue, What about pizza symbol:

🍕️ "\ud83c\udf55\ufe0f" https://emojipedia.org/slice-of-pizza/

U+1F355 U+FE0F

is this emoji with variation selector a valid emoji sequence? Becasue it matches only first two codepoints of surrogate pair and ignore variation selector.

from emoji-regex.

mathiasbynens avatar mathiasbynens commented on August 25, 2024

@jcubic Let's look up U+1F355 in https://unicode.org/Public/emoji/latest/emoji-data.txt. It contains:

1F337..1F37C  ; Emoji                #  6.0 [70] (🌷..🍼)    tulip..baby bottle
...
1F337..1F37C  ; Emoji_Presentation   #  6.0 [70] (🌷..🍼)    tulip..baby bottle

It has Emoji_Presentation=True, so it doesn't need the U+FE0F to be displayed as an emoji (per the spec).

from emoji-regex.

jcubic avatar jcubic commented on August 25, 2024

Oh, thanks, I was not sure about this one.

from emoji-regex.

mathiasbynens avatar mathiasbynens commented on August 25, 2024

macOS and iOS emoji input has recently improved to be more in line with the spec. I'm hoping Apple has solved (or will continue to solve) this problem so that we don't need to work around it in emoji-regex.

For your use case, you could check if the string ends with a variation selector, and remove it before further processing the string.

from emoji-regex.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.