This is an example gist repo showcasing a bug that Safari applies string normalization when pasteboard content is applied
curl -o- https://gist.githubusercontent.com/JLHwung/64fed33e2dbb3da7a18566fab26f045f/raw/75a7be7ac00626e58ec93a90ade70909b1bd7fe1/test.js | pbcopy
Open Safari console, paste the copied contents.
Expected:
It should alert 1f7d
.
Actual:
It alerts 3ce
. (Safari)
Other browers:
Both Chrome and Firefox alert 1f7d
as expected.
Is is a JSC bug?
No. If you save test.js
and open by Safari, it alerts 1f7d
as expected.
The ώ in source file is U+1F7D that has Singleton Decompositions, which means
String.fromCodePoint(0x1f7d).normalize() === String.fromCodePoint(0x3ce)
It prints incorrect code point because when the pasted source is excuted, U+1F7D has been normalized to U+03CE.