Skip to content

Fix emoji replacement issue affecting strings containing non-BMP characters - #4139

Open
nesevis wants to merge 2 commits into
SwiftPackageIndex:mainfrom
nesevis:fix-emoji-replacement-issue
Open

nesevis wants to merge 2 commits into
SwiftPackageIndex:mainfrom
nesevis:fix-emoji-replacement-issue

Conversation

@nesevis

@nesevis nesevis commented Aug 17, 2026

Copy link
Copy Markdown

This PR fixes a tiny bug introduced in #487 where the length given to the NSRange used for the regex lookup is passed the String.count, which only matches the whole string when it contains BMP-only characters.

EmojiStorage.replace(in:)’s range was off for strings with non-BMP characters, where a single Character contains two UTF-16 code points
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.

1 participant