|
|
|
@ -47,6 +47,11 @@ function utf16leread(data/*:string*/)/*:string*/ {
|
|
|
|
|
for(var i = 0; i < (data.length>>1); ++i) o[i] = String.fromCharCode(data.charCodeAt(2*i) + (data.charCodeAt(2*i+1)<<8));
|
|
|
|
|
return o.join("");
|
|
|
|
|
}
|
|
|
|
|
function utf16lereadu(data/*:Uint8Array*/)/*:string*/ {
|
|
|
|
|
var o/*:Array<string>*/ = [];
|
|
|
|
|
for(var i = 0; i < (data.length>>1); ++i) o[i] = String.fromCharCode(data[2*i] + (data[2*i+1]<<8));
|
|
|
|
|
return o.join("");
|
|
|
|
|
}
|
|
|
|
|
function utf16beread(data/*:string*/)/*:string*/ {
|
|
|
|
|
var o/*:Array<string>*/ = [];
|
|
|
|
|
for(var i = 0; i < (data.length>>1); ++i) o[i] = String.fromCharCode(data.charCodeAt(2*i+1) + (data.charCodeAt(2*i)<<8));
|
|
|
|
@ -1435,7 +1440,7 @@ function slice_by_16_tables(T) {
|
|
|
|
|
for(c = 256 + n; c < 4096; c += 256) v = table[c] = (v >>> 8) ^ T[v & 0xFF];
|
|
|
|
|
}
|
|
|
|
|
var out = [];
|
|
|
|
|
for(n = 1; n != 16; ++n) out[n - 1] = typeof Int32Array !== 'undefined' ? table.subarray(n * 256, n * 256 + 256) : table.slice(n * 256, n * 256 + 256);
|
|
|
|
|
for(n = 1; n != 16; ++n) out[n - 1] = typeof Int32Array !== 'undefined' && typeof table.subarray == "function" ? table.subarray(n * 256, n * 256 + 256) : table.slice(n * 256, n * 256 + 256);
|
|
|
|
|
return out;
|
|
|
|
|
}
|
|
|
|
|
var TT = slice_by_16_tables(T0);
|
|
|
|
@ -25719,7 +25724,13 @@ function read_plaintext_raw(data/*:RawData*/, o/*:ParseOpts*/)/*:Workbook*/ {
|
|
|
|
|
function read_utf16(data/*:RawData*/, o/*:ParseOpts*/)/*:Workbook*/ {
|
|
|
|
|
var d = data;
|
|
|
|
|
if(o.type == 'base64') d = Base64_decode(d);
|
|
|
|
|
d = typeof $cptable !== "undefined" ? $cptable.utils.decode(1200, d.slice(2), 'str') : utf16leread(d.slice(2));
|
|
|
|
|
if(typeof ArrayBuffer !== "undefined" && data instanceof ArrayBuffer) d = new Uint8Array(data);
|
|
|
|
|
d = typeof $cptable !== "undefined" ? $cptable.utils.decode(1200, d.slice(2), 'str') : (
|
|
|
|
|
(has_buf && Buffer.isBuffer(data)) ? data.slice(2).toString("utf16le") :
|
|
|
|
|
(typeof Uint8Array !== "undefined" && d instanceof Uint8Array) ? (
|
|
|
|
|
typeof TextDecoder !== "undefined" ? new TextDecoder("utf-16le").decode(d.slice(2)) : utf16lereadu(d.slice(2))
|
|
|
|
|
) : utf16leread(d.slice(2))
|
|
|
|
|
);
|
|
|
|
|
o.type = "binary";
|
|
|
|
|
return read_plaintext(d, o);
|
|
|
|
|
}
|
|
|
|
|