mirror of
https://github.com/kichikuou/xsystem35-sdl2.git
synced 2026-10-11 16:48:17 +03:00
Add a fallback for TextDecoder
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
importScripts('text-decoder.js');
|
||||
|
||||
class ISO9660FileSystem {
|
||||
private pvd: PVD;
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user