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
> var aaa = new Uint8Array(new TextEncoder().encode("wrong hello").buffer, 6);
> new TextDecoder().decode(aaa);
"hello" // Chrome native
> new TextDecoderPolyfill().decode(aaa);
"wrong hello" // polyfill
A simple fix could be var buffer = (inputArrayOrBuffer && inputArrayOrBuffer.buffer && inputArrayOrBuffer.buffer.slice(inputArrayOrBuffer.byteOffset, inputArrayOrBuffer.byteOffset + inputArrayOrBuffer.byteLength)) || inputArrayOrBuffer;
instead
The text was updated successfully, but these errors were encountered:
At https://github.com/anonyco/FastestSmallestTextEncoderDecoder/blob/master/individual/FastestTextDecoderPolyfill.src.js#L52 the input Uint8Array sometimes carry a non-zero byteOffset, which is needed to get the correct underlying ArrayBuffer.
A simple fix could be
var buffer = (inputArrayOrBuffer && inputArrayOrBuffer.buffer && inputArrayOrBuffer.buffer.slice(inputArrayOrBuffer.byteOffset, inputArrayOrBuffer.byteOffset + inputArrayOrBuffer.byteLength)) || inputArrayOrBuffer;
instead
The text was updated successfully, but these errors were encountered: