Closed opatomic closed 4 years ago
Funny, I just discovered a Chrome bug: typing "\uDC00" into the Chrome console causes Chrome to crash. It seems Chrome doesn't like incomplete surrogates just as much as this library, lol: https://bugs.chromium.org/p/chromium/issues/detail?id=1092264
When an out of order surrogate is encountered it should be replaced with the replacement character (utf-8 bytes 0xef 0xbf 0xbd).
Example:
console.log((new TextEncoder()).encode("\uDC00"));
result: Uint8Array(3) [ 237, 176, 128 ] expected: Uint8Array(3) [ 239, 191, 189 ]