Files
kichikuou_xsystem35-sdl2/web/worker/text-decoder.ts
T

19 lines
508 B
TypeScript

class FallbackTextDecoder {
constructor(utfLabel?: string) {}
decode(buffer: DataView): string {
var out = '';
for (var i = 0; i < buffer.byteLength; i++) {
let c = buffer.getUint8(i);
if (c < 128)
out += String.fromCharCode(c);
else
out += '%' + c.toString(16);
}
return out;
}
}
if (!(<any>self).TextDecoder)
(<any>self).TextDecoder = <TextEncoding.TextDecoderStatic>FallbackTextDecoder;