Smile icon indicating copy to clipboard operation
Smile copied to clipboard

Smile.unmodify handles ZWJ sequences in potentially unexpected ways

Open Sweeper777 opened this issue 3 years ago • 2 comments

Consider 👩🏻‍❤️‍💋‍👨🏼, which is formed of

  • 👩 (woman)
  • Light Skin Tone
  • ZERO WIDTH JOINER
  • HEAVY BLACK HEART
  • VARIATION SELECTOR-16
  • ZERO WIDTH JOINER
  • 💋 (kiss mark)
  • ZERO WIDTH JOINER
  • 👨 (man)
  • Medium-light Skin Tone

If I do

Smile.unmodify(emoji: "👩🏻‍❤️‍💋‍👨🏼")

Everything except the 👩 is removed. This completely changes the meaning of the emoji, which I don't think unmodify is supposed to do. I had expected 👩‍❤️‍💋‍👨 instead. Is this intentional?

Sweeper777 avatar Oct 07 '21 08:10 Sweeper777

Hi, it is expected to keep just the "prominent" info. Maybe you can try disassemble method ?

onmyway133 avatar Oct 08 '21 12:10 onmyway133

Ah, so you have another method for this purpose :) disassemble does remove the modifiers, which is what I want. However, it also removes the heart :(

Sweeper777 avatar Oct 09 '21 07:10 Sweeper777