Unicode emoji modifiers are handled differently in titles and post content πŸ‘¨β€πŸŒΎ πŸ’β€β™€οΈ

Unicode emoji modifiers are not being handled in the same way for topic titles and post content. In titles, they are displayed incorrectly.

For example:

Unicode emoji: πŸ‘¨β€πŸŒΎ
In post content: :man_farmer:
Title: see title of this topic

13 Likes

Is happening somewhere in fancy_title function in topic.rb

Will investigate further.

1 Like

Oh I know why :stuck_out_tongue:

This will be fixed by https://github.com/discourse/discourse/pull/7095

Last year, I pushed last emojis before apple had updated the set, using another set for missing emojis.

11 Likes

Damn… And I thought it had something to do with unicode_unescape in emoji.rb converting the modifier to its two respective emojis.

<code>πŸ‘¨&zwj;🌾</code> => :man: :ear_of_rice:

So close and yet so far :frowning: :smiley:

4 Likes

The title is a different issue yes. Sorry didnt make it clear I was talking of the post content difference.

4 Likes

Opened a PR :slight_smile:

https://github.com/discourse/discourse/pull/7156

With that fix also came an enhancement for the performEmojiUnescape function to now also support unicode emojis :partying_face:

6 Likes

This was merged, thanks @venarius - the topic titles look good now :smiley:

On a related note, it seems that some Unicode emojis are not being converted properly in post content. Inserting the β€œwoman tipping hand” emoji from iOS results in this: :tipping_hand_woman:

It seems to work correctly, but then inserts an extra ‍♀ for some reason. It works fine in the topic title.

5 Likes

@david I will have a look at the post content :slight_smile: Thanks for the info!

6 Likes

Just noticed that it looks correctly in the title because the regex didn’t match on two emojis next to each other, which is why the emojis in the title are currently not escaped and thus the unicode emojis are directly rendered.

Just opened a PR for this.

https://github.com/discourse/discourse/pull/7282

Regarding this error I was able to notice that in lib/emoji/db.json there is

{
  "code": "1f481",
  "name": "tipping_hand_woman"
}

which should be

{
  "code": "1f481-200d-2640-fe0f",
  "name": "tipping_hand_woman"
}

@joffreyjaffeux is there an update needed for the db.json? If yes, I would love to take care of this :slight_smile:

7 Likes

Hi tim,

sorry fixed it directly, it’s honestly not worth PRs and reviews, it’s a matter of copy/pasting few lines and running some rake tasks.

I can however explain you how it happened: previously some emojis were genderless, and then woman/man version were introduced. And if I remember correctly some of the genderless got the woman version and some the man version. Which is exactly what you found out.

If you find another one, here is the process:

And :tada:

:tipping_hand_woman:

7 Likes

This topic was automatically closed after 28 hours. New replies are no longer allowed.