[Webkit-unassigned] [Bug 205477] New: Unicode Regex with Emojis corrupts string replacement
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Dec 19 16:01:06 PST 2019
https://bugs.webkit.org/show_bug.cgi?id=205477
Bug ID: 205477
Summary: Unicode Regex with Emojis corrupts string replacement
Product: WebKit
Version: Safari 13
Hardware: iPhone / iPad
OS: iOS 13
Status: NEW
Severity: Major
Priority: P2
Component: JavaScriptCore
Assignee: webkit-unassigned at lists.webkit.org
Reporter: schuyler at jewlr.com
Created attachment 386160
--> https://bugs.webkit.org/attachment.cgi?id=386160&action=review
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.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20191220/350a13dd/attachment.htm>
More information about the webkit-unassigned
mailing list