You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make V8 string to NSString conversions UTF-16 faithful
V8 strings are UTF-16, but several bridge points round-tripped them through
UTF-8 before building an NSString (and one reverse direction did too). That
path corrupts lone surrogates, which get replaced with U+FFFD, and where it
used C-string APIs (stringWithUTF8String:, [NSString UTF8String] folded into
a std::string) it truncated at an embedded NUL.
Rework tns::ToUtf16String to read the V8 string's native two-byte buffer
directly, which also drops the deprecated std::codecvt_utf8_utf16. Switch the
DictionaryAdapter, Interop and ArgConverter string sites to ToUtf16String +
stringWithCharacters:length:, and pass NSString straight to ToV8String instead
of going through a UTF8String C string.
Add TestRunner cases asserting lone surrogates survive the JS to NSString
bridge: each reads the bridged string's first UTF-16 code unit straight out of
its buffer and checks it is unchanged (high U+D834 and low U+DC00), whereas the
old UTF-8 round trip would have turned either into U+FFFD.
0 commit comments