signalapp / Signal-Android

A private messenger for Android.
https://signal.org
GNU Affero General Public License v3.0
25.44k stars 6.09k forks source link

Multi-character emojis in names render the wrong character on profile pictures #12212

Closed WhyNotHugo closed 2 years ago

WhyNotHugo commented 2 years ago

Bug description

I have a contact name Bob 🇨🇿 (I know a few people with the same name, so an emoji in the contact's name is super handy. Name if fictitious in this example).

Note that this flag (and all flags, actually) is actually a two-part unicode glyph, which is 🇨 and 🇳 one after the other.

Steps to reproduce

Make sure you pick a contact with no actual profile picture.

Actual result: Signal renders profile pictures for contacts based on the first letter of their first and last name, which in this case, should be considered B🇨🇿.

Expected result: It seems signal doesn't parse unicode correctly somehow, but the contact's profile pic actually contains B🇨, which is incorrect (and confusing).

Device info

Device: OnePlus 9 Android version: LineageOS 18 Signal version: 5.35.3

WhyNotHugo commented 2 years ago

Oh, the right name/term for these is grapheme clusters:

A grapheme cluster is a sequence of one or more Unicode code points that should be treated as a single unit by various processes: Text-editing software should generally allow placement of the cursor only at grapheme cluster boundaries.

WhyNotHugo commented 2 years ago

Thanks!