Skip to content

Conversation

@fueerqan
Copy link

@fueerqan fueerqan commented Jun 4, 2025

Improve grapheme cluster counting for flag emojis

Addresses an issue where flag emojis (composed of two or more consecutive regional indicator symbols) were incorrectly counted as a single grapheme cluster. The code now correctly identifies and counts each regional indicator symbol, resulting in accurate counts for flag emojis like 🇯🇵🇯🇵🇯🇵 (now counted as 3, previously 1).

fueerqan added 2 commits June 4, 2025 16:06
Fix: Improve grapheme cluster counting for flag emojis

Addresses an issue where flag emojis (composed of two regional indicator symbols) were incorrectly counted as a single grapheme cluster. The code now correctly identifies and counts each regional indicator symbol, resulting in accurate counts for flag emojis like 🇯🇵🇯🇵 (now counted as 2).
@hiking93
Copy link
Owner

hiking93 commented Jul 9, 2025

Do you have a reproducible sample for this? I tried "🇯🇵🇯🇵🇯🇵" and it outputs [4, 8, 12] which is expected.

@hiking93 hiking93 self-requested a review July 9, 2025 07:18
@fueerqan
Copy link
Author

Do you have a reproducible sample for this? I tried "🇯🇵🇯🇵🇯🇵" and it outputs [4, 8, 12] which is expected.

That is the real sample that I faced, I tried to break consecutive flags, but it counted as 1 (only the first flag's index). If you can got the correct result, should I close this PR?

@hiking93
Copy link
Owner

Do you have a reproducible sample for this? I tried "🇯🇵🇯🇵🇯🇵" and it outputs [4, 8, 12] which is expected.

That is the real sample that I faced, I tried to break consecutive flags, but it counted as 1 (only the first flag's index). If you can got the correct result, should I close this PR?

You can close the PR if you wish. Or if you can provide your environment that can reproduce this issue, I would like to know.

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.

2 participants