Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handling of emojis with ZWJ sequences in profile initials #5023

Merged
merged 1 commit into from
Apr 27, 2024

Conversation

absidue
Copy link
Member

@absidue absidue commented Apr 25, 2024

Fix handling of emojis with ZWJ sequences in profile initials

Pull Request Type

  • Bugfix

Description

At the moment we use Array.from to get the first character in the profile name to use as the initial in the bubble, while that correctly handles basic emojis, it doesn't handle flag or family emojis as well as ones with skin tone modifiers very well, splitting them up into their individual characters instead of keeping them as one unit. This pull request fixes that by using Intl.Segmenter instead, which does locale aware splitting and also splits by user-perceived character, so it keeps the emojis intact.

Screenshots

Beforehand

before

Afterwards

after

Testing

Test profile names with some complex emojis in them:
https://emojipedia.org/flags
https://emojipedia.org/emoji-zwj-sequence
https://emojipedia.org/people#families-couples

Please note that Windows doesn't show flags correctly, that's not an issue with FreeTube but an issue with Windows.

Emoji flags are supported on all major platforms except Windows, which displays two-letter country codes instead of emoji flag images. Windows has never supported any national flag emoji design.

Desktop

  • OS: Windows
  • OS Version: 10
  • FreeTube version: 0.20.0

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) April 25, 2024 20:18
@github-actions github-actions bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label Apr 25, 2024
Copy link
Collaborator

@kommunarr kommunarr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. TIL!

Copy link
Collaborator

@PikachuEXE PikachuEXE left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Off topic, I would like to see it displayed as

image
https://emojipedia.org/woman-technologist

@FreeTubeBot FreeTubeBot merged commit 88bed9e into FreeTubeApp:development Apr 27, 2024
5 checks passed
@github-actions github-actions bot removed the PR: waiting for review For PRs that are complete, tested, and ready for review label Apr 27, 2024
@absidue absidue deleted the fix-profile-emojis branch April 27, 2024 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants