WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED DUPLICATE of
bug 267011
205477
Unicode Regex with Emojis corrupts string replacement
https://bugs.webkit.org/show_bug.cgi?id=205477
Summary
Unicode Regex with Emojis corrupts string replacement
schuyler
Reported
2019-12-19 16:01:06 PST
Created
attachment 386160
[details]
Reproduction example Given a surrogate-pair emoji:
https://emojipedia.org/blue-heart/
And a string containing it: foobar💙 And a Regular Expression such as this: const re = new RegExp('[^a-zA-Z💙]', 'uig') A replacement such as this on iOS: "foobar💙".replace(re, '') Yields a corrupted string: "foobar�" It seems that the replacement only preserves the first half of the surrogate pair, even though the regular expression has the unicode flag enabled. On MacOS Safari, the result is completely missing emojis. On an alternative browser like Chrome, the result still contains the 💙 emoji. This reproduction case has been known to work before on Safari, but now no longer seems to be the case.
Attachments
Reproduction example
(10.11 KB, image/png)
2019-12-19 16:01 PST
,
schuyler
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2019-12-19 23:24:35 PST
<
rdar://problem/58103878
>
Alexey Proskuryakov
Comment 2
2023-05-18 14:56:10 PDT
***
Bug 256948
has been marked as a duplicate of this bug. ***
wcshds
Comment 3
2023-10-14 00:33:36 PDT
Here is a simple reproduction demo. This bug is very annoying, so I'd like to know if there is any progress?
https://stackblitz.com/fork/github/wcshds/safari-regex-replace-bug?file=src%2FApp.vue&terminal=dev
Alexey Shvayka
Comment 4
2024-01-12 07:58:25 PST
This was fixed in
https://commits.webkit.org/272928@main
. I've checked that both test cases (
https://bugs.webkit.org/show_bug.cgi?id=205477#c0
,
https://bugs.webkit.org/show_bug.cgi?id=205477#c3
) work correctly. *** This bug has been marked as a duplicate of
bug 267011
***
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug