version bump 1.14.0: Buffer.from node 4.x fix
This commit is contained in:
parent
58ebd1ff6c
commit
cbdc9486c1
34
codepage.md
34
codepage.md
@ -448,11 +448,28 @@ while the input format is automatically determined.
|
||||
|
||||
# Tests
|
||||
|
||||
The tests include JS validity tests (requiring or evaluating code):
|
||||
|
||||
```>test.js
|
||||
var fs = require('fs'), assert = require('assert'), vm = require('vm');
|
||||
var cptable, sbcs;
|
||||
|
||||
```
|
||||
|
||||
Due to a bug in `Buffer.from` in node `4.0 - 4.4`, a special check is needed:
|
||||
|
||||
```>test.js
|
||||
var Buffer_from = function(){};
|
||||
|
||||
if(typeof Buffer !== 'undefined') {
|
||||
var nbfs = !Buffer.from;
|
||||
if(!nbfs) try { Buffer.from("foo", "utf8"); } catch(e) { nbfs = true; }
|
||||
Buffer_from = nbfs ? function(buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); } : Buffer.from.bind(Buffer);
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
The tests include JS validity tests (requiring or evaluating code):
|
||||
|
||||
```>test.js
|
||||
describe('source', function() {
|
||||
it('should load node', function() { cptable = require('./'); });
|
||||
it('should load sbcs', function() { sbcs = require('./sbcs'); });
|
||||
@ -565,7 +582,7 @@ describe('entry conditions', function() {
|
||||
var arr = cptable.utils.encode(cp,i.split(""),e);
|
||||
assert.deepEqual(str,arr);
|
||||
if(typeof Buffer === 'undefined') return;
|
||||
var buf = cptable.utils.encode(cp,Buffer.from(i),e);
|
||||
var buf = cptable.utils.encode(cp,Buffer_from(i),e);
|
||||
assert.deepEqual(str,buf);
|
||||
};
|
||||
cptable.utils.cache.encache();
|
||||
@ -593,7 +610,7 @@ describe('entry conditions', function() {
|
||||
var arr = cptable.utils.decode(cp,s.join?s.join(""):s);
|
||||
assert.deepEqual(str,arr);
|
||||
if(typeof Buffer === 'undefined') return;
|
||||
var buf = cptable.utils.decode(cp,Buffer.from(i));
|
||||
var buf = cptable.utils.decode(cp,Buffer_from(i));
|
||||
assert.deepEqual(str,buf);
|
||||
};
|
||||
cptable.utils.cache.encache();
|
||||
@ -603,7 +620,7 @@ describe('entry conditions', function() {
|
||||
};
|
||||
describe('decode', function() {
|
||||
it('CP 1252 : sbcs', function() { chkde(1252,[0x66, 0x6f, 0x6f, 0x62, 0x61, 0x72]); }); /* "foobar" */
|
||||
if(typeof Buffer !== 'undefined') it('CP 708 : sbcs', function() { chkde(708, Buffer.from([0xca, 0x20, 0x61, 0x6e, 0x64, 0x20, 0xcb, 0x20, 0x73, 0x6d, 0x69, 0x6c, 0x65, 0x79, 0x20, 0x66, 0x61, 0x63, 0x65, 0x73])); }); /* ("ت and ث smiley faces") */
|
||||
if(typeof Buffer !== 'undefined') it('CP 708 : sbcs', function() { chkde(708, Buffer_from([0xca, 0x20, 0x61, 0x6e, 0x64, 0x20, 0xcb, 0x20, 0x73, 0x6d, 0x69, 0x6c, 0x65, 0x79, 0x20, 0x66, 0x61, 0x63, 0x65, 0x73])); }); /* ("ت and ث smiley faces") */
|
||||
it('CP 936 : dbcs', function() { chkde(936, [0xd5, 0xe2, 0xca, 0xc7, 0xd6, 0xd0, 0xce, 0xc4, 0xd7, 0xd6, 0xb7, 0xfb, 0xb2, 0xe2, 0xca, 0xd4]);}); /* "这是中文字符测试" */
|
||||
});
|
||||
});
|
||||
@ -754,7 +771,7 @@ describe('failures', function() {
|
||||
```json>package.json
|
||||
{
|
||||
"name": "codepage",
|
||||
"version": "1.13.0",
|
||||
"version": "1.14.0",
|
||||
"author": "SheetJS",
|
||||
"description": "pure-JS library to handle codepages",
|
||||
"keywords": [ "codepage", "iconv", "convert", "strings" ],
|
||||
@ -807,6 +824,7 @@ describe('failures', function() {
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
"bin",
|
||||
"bits/*.js",
|
||||
"types/index.d.ts",
|
||||
"types/*.json",
|
||||
"cptable.js",
|
||||
@ -825,10 +843,12 @@ describe('failures', function() {
|
||||
```
|
||||
|
||||
```>.gitignore
|
||||
node_modules
|
||||
package-lock.json
|
||||
*.tgz
|
||||
.gitignore
|
||||
codepages/
|
||||
.vocrc
|
||||
node_modules/
|
||||
make.sh
|
||||
make.njs
|
||||
misc/coverage.html
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* cpexcel.js (C) 2013-present SheetJS -- http://sheetjs.com */
|
||||
/*jshint -W100 */
|
||||
var cptable = {version:"1.13.0"};
|
||||
var cptable = {version:"1.14.0"};
|
||||
cptable[437] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
cptable[620] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÇüéâäàąçêëèïîćÄĄĘęłôöĆûùŚÖÜ¢Ł¥śƒŹŻóÓńŃźż¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
cptable[737] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩαβγδεζηθικλμνξοπρσςτυφχψ░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀ωάέήϊίόύϋώΆΈΉΊΌΎΏ±≥≤ΪΫ÷≈°∙·√ⁿ²■ ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* cptable.js (C) 2013-present SheetJS -- http://sheetjs.com */
|
||||
/*jshint -W100 */
|
||||
var cptable = {version:"1.13.0"};
|
||||
var cptable = {version:"1.14.0"};
|
||||
cptable[37] = (function(){ var d = "\u0000\u0001\u0002\u0003\t\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013
\b\u0018\u0019\u001c\u001d\u001e\u001f\n\u0017\u001b\u0005\u0006\u0007\u0016\u0004\u0014\u0015\u001a âäàáãåçñ¢.<(+|&éêëèíîïìß!$*);¬-/ÂÄÀÁÃÅÇѦ,%_>?øÉÊËÈÍÎÏÌ`:#@'=\"Øabcdefghi«»ðýþ±°jklmnopqrªºæ¸Æ¤µ~stuvwxyz¡¿ÐÝÞ®^£¥·©§¶¼½¾[]¯¨´×{ABCDEFGHIôöòóõ}JKLMNOPQR¹ûüùúÿ\\÷STUVWXYZ²ÔÖÒÓÕ0123456789³ÛÜÙÚ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
cptable[437] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
cptable[500] = (function(){ var d = "\u0000\u0001\u0002\u0003\t\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013
\b\u0018\u0019\u001c\u001d\u001e\u001f\n\u0017\u001b\u0005\u0006\u0007\u0016\u0004\u0014\u0015\u001a âäàáãåçñ[.<(+!&éêëèíîïìß]$*);^-/ÂÄÀÁÃÅÇѦ,%_>?øÉÊËÈÍÎÏÌ`:#@'=\"Øabcdefghi«»ðýþ±°jklmnopqrªºæ¸Æ¤µ~stuvwxyz¡¿ÐÝÞ®¢£¥·©§¶¼½¾¬|¯¨´×{ABCDEFGHIôöòóõ}JKLMNOPQR¹ûüùúÿ\\÷STUVWXYZ²ÔÖÒÓÕ0123456789³ÛÜÙÚ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
|
@ -47,9 +47,11 @@ type DecoderMap = {[id:CPIndex]:Decoder};
|
||||
var cca = function cca(x/*:string*/)/*:number*/ { return x.charCodeAt(0); };
|
||||
|
||||
var has_buf/*:boolean*/ = (typeof Buffer !== 'undefined');
|
||||
var Buffer_from = function(){};
|
||||
if(has_buf) {
|
||||
// $FlowIgnore
|
||||
if(!Buffer.from) Buffer.from = function(buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); };
|
||||
var nbfs = !Buffer.from;
|
||||
if(!nbfs) try { Buffer.from("foo", "utf8"); } catch(e) { nbfs = true; }
|
||||
Buffer_from = nbfs ? function(buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); } : Buffer.from.bind(Buffer);
|
||||
// $FlowIgnore
|
||||
if(!Buffer.allocUnsafe) Buffer.allocUnsafe = function(n) { return new Buffer(n); };
|
||||
|
||||
@ -330,7 +332,7 @@ type DecoderMap = {[id:CPIndex]:Decoder};
|
||||
}
|
||||
else if((M=magic[cp])) switch(M) {
|
||||
case "utf8":
|
||||
if(has_buf && isstr/*:: && typeof data == 'string' */) { out = Buffer.from(data, M); j = out.length; break; }
|
||||
if(has_buf && isstr/*:: && typeof data == 'string' */) { out = Buffer_from(data, M); j = out.length; break; }
|
||||
for(i = 0; i < len; ++i, ++j) {
|
||||
w = isstr/*:: && typeof data == 'string' */ ? data.charCodeAt(i) : data[i].charCodeAt(0);
|
||||
if(w <= 0x007F) out[j] = w;
|
||||
@ -352,7 +354,7 @@ type DecoderMap = {[id:CPIndex]:Decoder};
|
||||
}
|
||||
break;
|
||||
case "ascii":
|
||||
if(has_buf && typeof data === "string") { out = Buffer.from(data, M); j = out.length; break; }
|
||||
if(has_buf && typeof data === "string") { out = Buffer_from(data, M); j = out.length; break; }
|
||||
for(i = 0; i < len; ++i, ++j) {
|
||||
w = isstr/*:: && typeof data == 'string' */ ? data.charCodeAt(i) : data[i].charCodeAt(0);
|
||||
if(w <= 0x007F) out[j] = w;
|
||||
@ -360,7 +362,7 @@ type DecoderMap = {[id:CPIndex]:Decoder};
|
||||
}
|
||||
break;
|
||||
case "utf16le":
|
||||
if(has_buf && typeof data === "string") { out = Buffer.from(data, M); j = out.length; break; }
|
||||
if(has_buf && typeof data === "string") { out = Buffer_from(data, M); j = out.length; break; }
|
||||
for(i = 0; i < len; ++i) {
|
||||
w = isstr/*:: && typeof data == 'string' */ ? data.charCodeAt(i) : data[i].charCodeAt(0);
|
||||
out[j++] = w&255;
|
||||
|
12
cputils.js
12
cputils.js
@ -40,9 +40,11 @@
|
||||
var cca = function cca(x) { return x.charCodeAt(0); };
|
||||
|
||||
var has_buf = (typeof Buffer !== 'undefined');
|
||||
var Buffer_from = function(){};
|
||||
if(has_buf) {
|
||||
// $FlowIgnore
|
||||
if(!Buffer.from) Buffer.from = function(buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); };
|
||||
var nbfs = !Buffer.from;
|
||||
if(!nbfs) try { Buffer.from("foo", "utf8"); } catch(e) { nbfs = true; }
|
||||
Buffer_from = nbfs ? function(buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); } : Buffer.from.bind(Buffer);
|
||||
// $FlowIgnore
|
||||
if(!Buffer.allocUnsafe) Buffer.allocUnsafe = function(n) { return new Buffer(n); };
|
||||
|
||||
@ -315,7 +317,7 @@
|
||||
}
|
||||
else if((M=magic[cp])) switch(M) {
|
||||
case "utf8":
|
||||
if(has_buf && isstr) { out = Buffer.from(data, M); j = out.length; break; }
|
||||
if(has_buf && isstr) { out = Buffer_from(data, M); j = out.length; break; }
|
||||
for(i = 0; i < len; ++i, ++j) {
|
||||
w = isstr ? data.charCodeAt(i) : data[i].charCodeAt(0);
|
||||
if(w <= 0x007F) out[j] = w;
|
||||
@ -337,7 +339,7 @@
|
||||
}
|
||||
break;
|
||||
case "ascii":
|
||||
if(has_buf && typeof data === "string") { out = Buffer.from(data, M); j = out.length; break; }
|
||||
if(has_buf && typeof data === "string") { out = Buffer_from(data, M); j = out.length; break; }
|
||||
for(i = 0; i < len; ++i, ++j) {
|
||||
w = isstr ? data.charCodeAt(i) : data[i].charCodeAt(0);
|
||||
if(w <= 0x007F) out[j] = w;
|
||||
@ -345,7 +347,7 @@
|
||||
}
|
||||
break;
|
||||
case "utf16le":
|
||||
if(has_buf && typeof data === "string") { out = Buffer.from(data, M); j = out.length; break; }
|
||||
if(has_buf && typeof data === "string") { out = Buffer_from(data, M); j = out.length; break; }
|
||||
for(i = 0; i < len; ++i) {
|
||||
w = isstr ? data.charCodeAt(i) : data[i].charCodeAt(0);
|
||||
out[j++] = w&255;
|
||||
|
File diff suppressed because one or more lines are too long
14
dist/cpexcel.full.js
vendored
14
dist/cpexcel.full.js
vendored
@ -1,6 +1,6 @@
|
||||
/* cpexcel.js (C) 2013-present SheetJS -- http://sheetjs.com */
|
||||
/*jshint -W100 */
|
||||
var cptable = {version:"1.13.0"};
|
||||
var cptable = {version:"1.14.0"};
|
||||
cptable[437] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
cptable[620] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÇüéâäàąçêëèïîćÄĄĘęłôöĆûùŚÖÜ¢Ł¥śƒŹŻóÓńŃźż¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
cptable[737] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩαβγδεζηθικλμνξοπρσςτυφχψ░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀ωάέήϊίόύϋώΆΈΉΊΌΎΏ±≥≤ΪΫ÷≈°∙·√ⁿ²■ ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
@ -1017,9 +1017,11 @@ if (typeof module !== 'undefined' && module.exports && typeof DO_NOT_EXPORT_CODE
|
||||
var cca = function cca(x) { return x.charCodeAt(0); };
|
||||
|
||||
var has_buf = (typeof Buffer !== 'undefined');
|
||||
var Buffer_from = function(){};
|
||||
if(has_buf) {
|
||||
// $FlowIgnore
|
||||
if(!Buffer.from) Buffer.from = function(buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); };
|
||||
var nbfs = !Buffer.from;
|
||||
if(!nbfs) try { Buffer.from("foo", "utf8"); } catch(e) { nbfs = true; }
|
||||
Buffer_from = nbfs ? function(buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); } : Buffer.from.bind(Buffer);
|
||||
// $FlowIgnore
|
||||
if(!Buffer.allocUnsafe) Buffer.allocUnsafe = function(n) { return new Buffer(n); };
|
||||
|
||||
@ -1292,7 +1294,7 @@ if (typeof module !== 'undefined' && module.exports && typeof DO_NOT_EXPORT_CODE
|
||||
}
|
||||
else if((M=magic[cp])) switch(M) {
|
||||
case "utf8":
|
||||
if(has_buf && isstr) { out = Buffer.from(data, M); j = out.length; break; }
|
||||
if(has_buf && isstr) { out = Buffer_from(data, M); j = out.length; break; }
|
||||
for(i = 0; i < len; ++i, ++j) {
|
||||
w = isstr ? data.charCodeAt(i) : data[i].charCodeAt(0);
|
||||
if(w <= 0x007F) out[j] = w;
|
||||
@ -1314,7 +1316,7 @@ if (typeof module !== 'undefined' && module.exports && typeof DO_NOT_EXPORT_CODE
|
||||
}
|
||||
break;
|
||||
case "ascii":
|
||||
if(has_buf && typeof data === "string") { out = Buffer.from(data, M); j = out.length; break; }
|
||||
if(has_buf && typeof data === "string") { out = Buffer_from(data, M); j = out.length; break; }
|
||||
for(i = 0; i < len; ++i, ++j) {
|
||||
w = isstr ? data.charCodeAt(i) : data[i].charCodeAt(0);
|
||||
if(w <= 0x007F) out[j] = w;
|
||||
@ -1322,7 +1324,7 @@ if (typeof module !== 'undefined' && module.exports && typeof DO_NOT_EXPORT_CODE
|
||||
}
|
||||
break;
|
||||
case "utf16le":
|
||||
if(has_buf && typeof data === "string") { out = Buffer.from(data, M); j = out.length; break; }
|
||||
if(has_buf && typeof data === "string") { out = Buffer_from(data, M); j = out.length; break; }
|
||||
for(i = 0; i < len; ++i) {
|
||||
w = isstr ? data.charCodeAt(i) : data[i].charCodeAt(0);
|
||||
out[j++] = w&255;
|
||||
|
2
dist/cpexcel.js
vendored
2
dist/cpexcel.js
vendored
@ -1,6 +1,6 @@
|
||||
/* cpexcel.js (C) 2013-present SheetJS -- http://sheetjs.com */
|
||||
/*jshint -W100 */
|
||||
var cptable = {version:"1.13.0"};
|
||||
var cptable = {version:"1.14.0"};
|
||||
cptable[437] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
cptable[620] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÇüéâäàąçêëèïîćÄĄĘęłôöĆûùŚÖÜ¢Ł¥śƒŹŻóÓńŃźż¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
cptable[737] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩαβγδεζηθικλμνξοπρσςτυφχψ░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀ωάέήϊίόύϋώΆΈΉΊΌΎΏ±≥≤ΪΫ÷≈°∙·√ⁿ²■ ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
|
14
dist/cptable.full.js
vendored
14
dist/cptable.full.js
vendored
@ -1,6 +1,6 @@
|
||||
/* cptable.js (C) 2013-present SheetJS -- http://sheetjs.com */
|
||||
/*jshint -W100 */
|
||||
var cptable = {version:"1.13.0"};
|
||||
var cptable = {version:"1.14.0"};
|
||||
cptable[37] = (function(){ var d = "\u0000\u0001\u0002\u0003\t\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013
\b\u0018\u0019\u001c\u001d\u001e\u001f\n\u0017\u001b\u0005\u0006\u0007\u0016\u0004\u0014\u0015\u001a âäàáãåçñ¢.<(+|&éêëèíîïìß!$*);¬-/ÂÄÀÁÃÅÇѦ,%_>?øÉÊËÈÍÎÏÌ`:#@'=\"Øabcdefghi«»ðýþ±°jklmnopqrªºæ¸Æ¤µ~stuvwxyz¡¿ÐÝÞ®^£¥·©§¶¼½¾[]¯¨´×{ABCDEFGHIôöòóõ}JKLMNOPQR¹ûüùúÿ\\÷STUVWXYZ²ÔÖÒÓÕ0123456789³ÛÜÙÚ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
cptable[437] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
cptable[500] = (function(){ var d = "\u0000\u0001\u0002\u0003\t\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013
\b\u0018\u0019\u001c\u001d\u001e\u001f\n\u0017\u001b\u0005\u0006\u0007\u0016\u0004\u0014\u0015\u001a âäàáãåçñ[.<(+!&éêëèíîïìß]$*);^-/ÂÄÀÁÃÅÇѦ,%_>?øÉÊËÈÍÎÏÌ`:#@'=\"Øabcdefghi«»ðýþ±°jklmnopqrªºæ¸Æ¤µ~stuvwxyz¡¿ÐÝÞ®¢£¥·©§¶¼½¾¬|¯¨´×{ABCDEFGHIôöòóõ}JKLMNOPQR¹ûüùúÿ\\÷STUVWXYZ²ÔÖÒÓÕ0123456789³ÛÜÙÚ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
@ -6387,9 +6387,11 @@ if (typeof module !== 'undefined' && module.exports && typeof DO_NOT_EXPORT_CODE
|
||||
var cca = function cca(x) { return x.charCodeAt(0); };
|
||||
|
||||
var has_buf = (typeof Buffer !== 'undefined');
|
||||
var Buffer_from = function(){};
|
||||
if(has_buf) {
|
||||
// $FlowIgnore
|
||||
if(!Buffer.from) Buffer.from = function(buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); };
|
||||
var nbfs = !Buffer.from;
|
||||
if(!nbfs) try { Buffer.from("foo", "utf8"); } catch(e) { nbfs = true; }
|
||||
Buffer_from = nbfs ? function(buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); } : Buffer.from.bind(Buffer);
|
||||
// $FlowIgnore
|
||||
if(!Buffer.allocUnsafe) Buffer.allocUnsafe = function(n) { return new Buffer(n); };
|
||||
|
||||
@ -6662,7 +6664,7 @@ if (typeof module !== 'undefined' && module.exports && typeof DO_NOT_EXPORT_CODE
|
||||
}
|
||||
else if((M=magic[cp])) switch(M) {
|
||||
case "utf8":
|
||||
if(has_buf && isstr) { out = Buffer.from(data, M); j = out.length; break; }
|
||||
if(has_buf && isstr) { out = Buffer_from(data, M); j = out.length; break; }
|
||||
for(i = 0; i < len; ++i, ++j) {
|
||||
w = isstr ? data.charCodeAt(i) : data[i].charCodeAt(0);
|
||||
if(w <= 0x007F) out[j] = w;
|
||||
@ -6684,7 +6686,7 @@ if (typeof module !== 'undefined' && module.exports && typeof DO_NOT_EXPORT_CODE
|
||||
}
|
||||
break;
|
||||
case "ascii":
|
||||
if(has_buf && typeof data === "string") { out = Buffer.from(data, M); j = out.length; break; }
|
||||
if(has_buf && typeof data === "string") { out = Buffer_from(data, M); j = out.length; break; }
|
||||
for(i = 0; i < len; ++i, ++j) {
|
||||
w = isstr ? data.charCodeAt(i) : data[i].charCodeAt(0);
|
||||
if(w <= 0x007F) out[j] = w;
|
||||
@ -6692,7 +6694,7 @@ if (typeof module !== 'undefined' && module.exports && typeof DO_NOT_EXPORT_CODE
|
||||
}
|
||||
break;
|
||||
case "utf16le":
|
||||
if(has_buf && typeof data === "string") { out = Buffer.from(data, M); j = out.length; break; }
|
||||
if(has_buf && typeof data === "string") { out = Buffer_from(data, M); j = out.length; break; }
|
||||
for(i = 0; i < len; ++i) {
|
||||
w = isstr ? data.charCodeAt(i) : data[i].charCodeAt(0);
|
||||
out[j++] = w&255;
|
||||
|
2
dist/cptable.js
vendored
2
dist/cptable.js
vendored
@ -1,6 +1,6 @@
|
||||
/* cptable.js (C) 2013-present SheetJS -- http://sheetjs.com */
|
||||
/*jshint -W100 */
|
||||
var cptable = {version:"1.13.0"};
|
||||
var cptable = {version:"1.14.0"};
|
||||
cptable[37] = (function(){ var d = "\u0000\u0001\u0002\u0003\t\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013
\b\u0018\u0019\u001c\u001d\u001e\u001f\n\u0017\u001b\u0005\u0006\u0007\u0016\u0004\u0014\u0015\u001a âäàáãåçñ¢.<(+|&éêëèíîïìß!$*);¬-/ÂÄÀÁÃÅÇѦ,%_>?øÉÊËÈÍÎÏÌ`:#@'=\"Øabcdefghi«»ðýþ±°jklmnopqrªºæ¸Æ¤µ~stuvwxyz¡¿ÐÝÞ®^£¥·©§¶¼½¾[]¯¨´×{ABCDEFGHIôöòóõ}JKLMNOPQR¹ûüùúÿ\\÷STUVWXYZ²ÔÖÒÓÕ0123456789³ÛÜÙÚ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
cptable[437] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
cptable[500] = (function(){ var d = "\u0000\u0001\u0002\u0003\t\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013
\b\u0018\u0019\u001c\u001d\u001e\u001f\n\u0017\u001b\u0005\u0006\u0007\u0016\u0004\u0014\u0015\u001a âäàáãåçñ[.<(+!&éêëèíîïìß]$*);^-/ÂÄÀÁÃÅÇѦ,%_>?øÉÊËÈÍÎÏÌ`:#@'=\"Øabcdefghi«»ðýþ±°jklmnopqrªºæ¸Æ¤µ~stuvwxyz¡¿ÐÝÞ®¢£¥·©§¶¼½¾¬|¯¨´×{ABCDEFGHIôöòóõ}JKLMNOPQR¹ûüùúÿ\\÷STUVWXYZ²ÔÖÒÓÕ0123456789³ÛÜÙÚ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
|
12
dist/cputils.js
vendored
12
dist/cputils.js
vendored
@ -40,9 +40,11 @@
|
||||
var cca = function cca(x) { return x.charCodeAt(0); };
|
||||
|
||||
var has_buf = (typeof Buffer !== 'undefined');
|
||||
var Buffer_from = function(){};
|
||||
if(has_buf) {
|
||||
// $FlowIgnore
|
||||
if(!Buffer.from) Buffer.from = function(buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); };
|
||||
var nbfs = !Buffer.from;
|
||||
if(!nbfs) try { Buffer.from("foo", "utf8"); } catch(e) { nbfs = true; }
|
||||
Buffer_from = nbfs ? function(buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); } : Buffer.from.bind(Buffer);
|
||||
// $FlowIgnore
|
||||
if(!Buffer.allocUnsafe) Buffer.allocUnsafe = function(n) { return new Buffer(n); };
|
||||
|
||||
@ -315,7 +317,7 @@
|
||||
}
|
||||
else if((M=magic[cp])) switch(M) {
|
||||
case "utf8":
|
||||
if(has_buf && isstr) { out = Buffer.from(data, M); j = out.length; break; }
|
||||
if(has_buf && isstr) { out = Buffer_from(data, M); j = out.length; break; }
|
||||
for(i = 0; i < len; ++i, ++j) {
|
||||
w = isstr ? data.charCodeAt(i) : data[i].charCodeAt(0);
|
||||
if(w <= 0x007F) out[j] = w;
|
||||
@ -337,7 +339,7 @@
|
||||
}
|
||||
break;
|
||||
case "ascii":
|
||||
if(has_buf && typeof data === "string") { out = Buffer.from(data, M); j = out.length; break; }
|
||||
if(has_buf && typeof data === "string") { out = Buffer_from(data, M); j = out.length; break; }
|
||||
for(i = 0; i < len; ++i, ++j) {
|
||||
w = isstr ? data.charCodeAt(i) : data[i].charCodeAt(0);
|
||||
if(w <= 0x007F) out[j] = w;
|
||||
@ -345,7 +347,7 @@
|
||||
}
|
||||
break;
|
||||
case "utf16le":
|
||||
if(has_buf && typeof data === "string") { out = Buffer.from(data, M); j = out.length; break; }
|
||||
if(has_buf && typeof data === "string") { out = Buffer_from(data, M); j = out.length; break; }
|
||||
for(i = 0; i < len; ++i) {
|
||||
w = isstr ? data.charCodeAt(i) : data[i].charCodeAt(0);
|
||||
out[j++] = w&255;
|
||||
|
14
dist/sbcs.full.js
vendored
14
dist/sbcs.full.js
vendored
@ -1,6 +1,6 @@
|
||||
/* sbcs.js (C) 2013-present SheetJS -- http://sheetjs.com */
|
||||
/*jshint -W100 */
|
||||
var cptable = {version:"1.13.0"};
|
||||
var cptable = {version:"1.14.0"};
|
||||
cptable[37] = (function(){ var d = "\u0000\u0001\u0002\u0003\t\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013
\b\u0018\u0019\u001c\u001d\u001e\u001f\n\u0017\u001b\u0005\u0006\u0007\u0016\u0004\u0014\u0015\u001a âäàáãåçñ¢.<(+|&éêëèíîïìß!$*);¬-/ÂÄÀÁÃÅÇѦ,%_>?øÉÊËÈÍÎÏÌ`:#@'=\"Øabcdefghi«»ðýþ±°jklmnopqrªºæ¸Æ¤µ~stuvwxyz¡¿ÐÝÞ®^£¥·©§¶¼½¾[]¯¨´×{ABCDEFGHIôöòóõ}JKLMNOPQR¹ûüùúÿ\\÷STUVWXYZ²ÔÖÒÓÕ0123456789³ÛÜÙÚ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
cptable[437] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
cptable[500] = (function(){ var d = "\u0000\u0001\u0002\u0003\t\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013
\b\u0018\u0019\u001c\u001d\u001e\u001f\n\u0017\u001b\u0005\u0006\u0007\u0016\u0004\u0014\u0015\u001a âäàáãåçñ[.<(+!&éêëèíîïìß]$*);^-/ÂÄÀÁÃÅÇѦ,%_>?øÉÊËÈÍÎÏÌ`:#@'=\"Øabcdefghi«»ðýþ±°jklmnopqrªºæ¸Æ¤µ~stuvwxyz¡¿ÐÝÞ®¢£¥·©§¶¼½¾¬|¯¨´×{ABCDEFGHIôöòóõ}JKLMNOPQR¹ûüùúÿ\\÷STUVWXYZ²ÔÖÒÓÕ0123456789³ÛÜÙÚ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
@ -151,9 +151,11 @@ if (typeof module !== 'undefined' && module.exports && typeof DO_NOT_EXPORT_CODE
|
||||
var cca = function cca(x) { return x.charCodeAt(0); };
|
||||
|
||||
var has_buf = (typeof Buffer !== 'undefined');
|
||||
var Buffer_from = function(){};
|
||||
if(has_buf) {
|
||||
// $FlowIgnore
|
||||
if(!Buffer.from) Buffer.from = function(buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); };
|
||||
var nbfs = !Buffer.from;
|
||||
if(!nbfs) try { Buffer.from("foo", "utf8"); } catch(e) { nbfs = true; }
|
||||
Buffer_from = nbfs ? function(buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); } : Buffer.from.bind(Buffer);
|
||||
// $FlowIgnore
|
||||
if(!Buffer.allocUnsafe) Buffer.allocUnsafe = function(n) { return new Buffer(n); };
|
||||
|
||||
@ -426,7 +428,7 @@ if (typeof module !== 'undefined' && module.exports && typeof DO_NOT_EXPORT_CODE
|
||||
}
|
||||
else if((M=magic[cp])) switch(M) {
|
||||
case "utf8":
|
||||
if(has_buf && isstr) { out = Buffer.from(data, M); j = out.length; break; }
|
||||
if(has_buf && isstr) { out = Buffer_from(data, M); j = out.length; break; }
|
||||
for(i = 0; i < len; ++i, ++j) {
|
||||
w = isstr ? data.charCodeAt(i) : data[i].charCodeAt(0);
|
||||
if(w <= 0x007F) out[j] = w;
|
||||
@ -448,7 +450,7 @@ if (typeof module !== 'undefined' && module.exports && typeof DO_NOT_EXPORT_CODE
|
||||
}
|
||||
break;
|
||||
case "ascii":
|
||||
if(has_buf && typeof data === "string") { out = Buffer.from(data, M); j = out.length; break; }
|
||||
if(has_buf && typeof data === "string") { out = Buffer_from(data, M); j = out.length; break; }
|
||||
for(i = 0; i < len; ++i, ++j) {
|
||||
w = isstr ? data.charCodeAt(i) : data[i].charCodeAt(0);
|
||||
if(w <= 0x007F) out[j] = w;
|
||||
@ -456,7 +458,7 @@ if (typeof module !== 'undefined' && module.exports && typeof DO_NOT_EXPORT_CODE
|
||||
}
|
||||
break;
|
||||
case "utf16le":
|
||||
if(has_buf && typeof data === "string") { out = Buffer.from(data, M); j = out.length; break; }
|
||||
if(has_buf && typeof data === "string") { out = Buffer_from(data, M); j = out.length; break; }
|
||||
for(i = 0; i < len; ++i) {
|
||||
w = isstr ? data.charCodeAt(i) : data[i].charCodeAt(0);
|
||||
out[j++] = w&255;
|
||||
|
2
dist/sbcs.js
vendored
2
dist/sbcs.js
vendored
@ -1,6 +1,6 @@
|
||||
/* sbcs.js (C) 2013-present SheetJS -- http://sheetjs.com */
|
||||
/*jshint -W100 */
|
||||
var cptable = {version:"1.13.0"};
|
||||
var cptable = {version:"1.14.0"};
|
||||
cptable[37] = (function(){ var d = "\u0000\u0001\u0002\u0003\t\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013
\b\u0018\u0019\u001c\u001d\u001e\u001f\n\u0017\u001b\u0005\u0006\u0007\u0016\u0004\u0014\u0015\u001a âäàáãåçñ¢.<(+|&éêëèíîïìß!$*);¬-/ÂÄÀÁÃÅÇѦ,%_>?øÉÊËÈÍÎÏÌ`:#@'=\"Øabcdefghi«»ðýþ±°jklmnopqrªºæ¸Æ¤µ~stuvwxyz¡¿ÐÝÞ®^£¥·©§¶¼½¾[]¯¨´×{ABCDEFGHIôöòóõ}JKLMNOPQR¹ûüùúÿ\\÷STUVWXYZ²ÔÖÒÓÕ0123456789³ÛÜÙÚ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
cptable[437] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
cptable[500] = (function(){ var d = "\u0000\u0001\u0002\u0003\t\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013
\b\u0018\u0019\u001c\u001d\u001e\u001f\n\u0017\u001b\u0005\u0006\u0007\u0016\u0004\u0014\u0015\u001a âäàáãåçñ[.<(+!&éêëèíîïìß]$*);^-/ÂÄÀÁÃÅÇѦ,%_>?øÉÊËÈÍÎÏÌ`:#@'=\"Øabcdefghi«»ðýþ±°jklmnopqrªºæ¸Æ¤µ~stuvwxyz¡¿ÐÝÞ®¢£¥·©§¶¼½¾¬|¯¨´×{ABCDEFGHIôöòóõ}JKLMNOPQR¹ûüùúÿ\\÷STUVWXYZ²ÔÖÒÓÕ0123456789³ÛÜÙÚ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
|
@ -448,11 +448,28 @@ while the input format is automatically determined.
|
||||
|
||||
# Tests
|
||||
|
||||
The tests include JS validity tests (requiring or evaluating code):
|
||||
|
||||
```>test.js
|
||||
var fs = require('fs'), assert = require('assert'), vm = require('vm');
|
||||
var cptable, sbcs;
|
||||
|
||||
```
|
||||
|
||||
Due to a bug in `Buffer.from` in node `4.0 - 4.4`, a special check is needed:
|
||||
|
||||
```>test.js
|
||||
var Buffer_from = function(){};
|
||||
|
||||
if(typeof Buffer !== 'undefined') {
|
||||
var nbfs = !Buffer.from;
|
||||
if(!nbfs) try { Buffer.from("foo", "utf8"); } catch(e) { nbfs = true; }
|
||||
Buffer_from = nbfs ? function(buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); } : Buffer.from.bind(Buffer);
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
The tests include JS validity tests (requiring or evaluating code):
|
||||
|
||||
```>test.js
|
||||
describe('source', function() {
|
||||
it('should load node', function() { cptable = require('./'); });
|
||||
it('should load sbcs', function() { sbcs = require('./sbcs'); });
|
||||
@ -565,7 +582,7 @@ describe('entry conditions', function() {
|
||||
var arr = cptable.utils.encode(cp,i.split(""),e);
|
||||
assert.deepEqual(str,arr);
|
||||
if(typeof Buffer === 'undefined') return;
|
||||
var buf = cptable.utils.encode(cp,Buffer.from(i),e);
|
||||
var buf = cptable.utils.encode(cp,Buffer_from(i),e);
|
||||
assert.deepEqual(str,buf);
|
||||
};
|
||||
cptable.utils.cache.encache();
|
||||
@ -593,7 +610,7 @@ describe('entry conditions', function() {
|
||||
var arr = cptable.utils.decode(cp,s.join?s.join(""):s);
|
||||
assert.deepEqual(str,arr);
|
||||
if(typeof Buffer === 'undefined') return;
|
||||
var buf = cptable.utils.decode(cp,Buffer.from(i));
|
||||
var buf = cptable.utils.decode(cp,Buffer_from(i));
|
||||
assert.deepEqual(str,buf);
|
||||
};
|
||||
cptable.utils.cache.encache();
|
||||
@ -603,7 +620,7 @@ describe('entry conditions', function() {
|
||||
};
|
||||
describe('decode', function() {
|
||||
it('CP 1252 : sbcs', function() { chkde(1252,[0x66, 0x6f, 0x6f, 0x62, 0x61, 0x72]); }); /* "foobar" */
|
||||
if(typeof Buffer !== 'undefined') it('CP 708 : sbcs', function() { chkde(708, Buffer.from([0xca, 0x20, 0x61, 0x6e, 0x64, 0x20, 0xcb, 0x20, 0x73, 0x6d, 0x69, 0x6c, 0x65, 0x79, 0x20, 0x66, 0x61, 0x63, 0x65, 0x73])); }); /* (" and smiley faces") */
|
||||
if(typeof Buffer !== 'undefined') it('CP 708 : sbcs', function() { chkde(708, Buffer_from([0xca, 0x20, 0x61, 0x6e, 0x64, 0x20, 0xcb, 0x20, 0x73, 0x6d, 0x69, 0x6c, 0x65, 0x79, 0x20, 0x66, 0x61, 0x63, 0x65, 0x73])); }); /* (" and smiley faces") */
|
||||
it('CP 936 : dbcs', function() { chkde(936, [0xd5, 0xe2, 0xca, 0xc7, 0xd6, 0xd0, 0xce, 0xc4, 0xd7, 0xd6, 0xb7, 0xfb, 0xb2, 0xe2, 0xca, 0xd4]);}); /* "" */
|
||||
});
|
||||
});
|
||||
@ -754,7 +771,7 @@ describe('failures', function() {
|
||||
```json>package.json
|
||||
{
|
||||
"name": "codepage",
|
||||
"version": "1.13.0",
|
||||
"version": "1.14.0",
|
||||
"author": "SheetJS",
|
||||
"description": "pure-JS library to handle codepages",
|
||||
"keywords": [ "codepage", "iconv", "convert", "strings" ],
|
||||
@ -807,6 +824,7 @@ describe('failures', function() {
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
"bin",
|
||||
"bits/*.js",
|
||||
"types/index.d.ts",
|
||||
"types/*.json",
|
||||
"cptable.js",
|
||||
@ -825,10 +843,12 @@ describe('failures', function() {
|
||||
```
|
||||
|
||||
```>.gitignore
|
||||
node_modules
|
||||
package-lock.json
|
||||
*.tgz
|
||||
.gitignore
|
||||
codepages/
|
||||
.vocrc
|
||||
node_modules/
|
||||
make.sh
|
||||
make.njs
|
||||
misc/coverage.html
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -448,11 +448,28 @@ while the input format is automatically determined.
|
||||
|
||||
+ACM Tests
|
||||
|
||||
The tests include JS validity tests (requiring or evaluating code):
|
||||
|
||||
+AGAAYABgAD4-test.js
|
||||
var fs +AD0 require('fs'), assert +AD0 require('assert'), vm +AD0 require('vm')+ADs
|
||||
var cptable, sbcs+ADs
|
||||
|
||||
+AGAAYABg
|
||||
|
||||
Due to a bug in +AGA-Buffer.from+AGA in node +AGA-4.0 - 4.4+AGA, a special check is needed:
|
||||
|
||||
+AGAAYABgAD4-test.js
|
||||
var Buffer+AF8-from +AD0 function()+AHsAfQA7
|
||||
|
||||
if(typeof Buffer +ACEAPQA9 'undefined') +AHs
|
||||
var nbfs +AD0 +ACE-Buffer.from+ADs
|
||||
if(+ACE-nbfs) try +AHs Buffer.from(+ACI-foo+ACI, +ACI-utf8+ACI)+ADs +AH0 catch(e) +AHs nbfs +AD0 true+ADs +AH0
|
||||
Buffer+AF8-from +AD0 nbfs ? function(buf, enc) +AHs return (enc) ? new Buffer(buf, enc) : new Buffer(buf)+ADs +AH0 : Buffer.from.bind(Buffer)+ADs
|
||||
+AH0
|
||||
|
||||
+AGAAYABg
|
||||
|
||||
The tests include JS validity tests (requiring or evaluating code):
|
||||
|
||||
+AGAAYABgAD4-test.js
|
||||
describe('source', function() +AHs
|
||||
it('should load node', function() +AHs cptable +AD0 require('./')+ADs +AH0)+ADs
|
||||
it('should load sbcs', function() +AHs sbcs +AD0 require('./sbcs')+ADs +AH0)+ADs
|
||||
@ -565,7 +582,7 @@ describe('entry conditions', function() +AHs
|
||||
var arr +AD0 cptable.utils.encode(cp,i.split(+ACIAIg),e)+ADs
|
||||
assert.deepEqual(str,arr)+ADs
|
||||
if(typeof Buffer +AD0APQA9 'undefined') return+ADs
|
||||
var buf +AD0 cptable.utils.encode(cp,Buffer.from(i),e)+ADs
|
||||
var buf +AD0 cptable.utils.encode(cp,Buffer+AF8-from(i),e)+ADs
|
||||
assert.deepEqual(str,buf)+ADs
|
||||
+AH0AOw
|
||||
cptable.utils.cache.encache()+ADs
|
||||
@ -593,7 +610,7 @@ describe('entry conditions', function() +AHs
|
||||
var arr +AD0 cptable.utils.decode(cp,s.join?s.join(+ACIAIg):s)+ADs
|
||||
assert.deepEqual(str,arr)+ADs
|
||||
if(typeof Buffer +AD0APQA9 'undefined') return+ADs
|
||||
var buf +AD0 cptable.utils.decode(cp,Buffer.from(i))+ADs
|
||||
var buf +AD0 cptable.utils.decode(cp,Buffer+AF8-from(i))+ADs
|
||||
assert.deepEqual(str,buf)+ADs
|
||||
+AH0AOw
|
||||
cptable.utils.cache.encache()+ADs
|
||||
@ -603,7 +620,7 @@ describe('entry conditions', function() +AHs
|
||||
+AH0AOw
|
||||
describe('decode', function() +AHs
|
||||
it('CP 1252 : sbcs', function() +AHs chkde(1252,+AFs-0x66, 0x6f, 0x6f, 0x62, 0x61, 0x72+AF0)+ADs +AH0)+ADs /+ACo +ACI-foobar+ACI +ACo-/
|
||||
if(typeof Buffer +ACEAPQA9 'undefined') it('CP 708 : sbcs', function() +AHs chkde(708, Buffer.from(+AFs-0xca, 0x20, 0x61, 0x6e, 0x64, 0x20, 0xcb, 0x20, 0x73, 0x6d, 0x69, 0x6c, 0x65, 0x79, 0x20, 0x66, 0x61, 0x63, 0x65, 0x73+AF0))+ADs +AH0)+ADs /+ACo (+ACIGKg and +Bis smiley faces+ACI) +ACo-/
|
||||
if(typeof Buffer +ACEAPQA9 'undefined') it('CP 708 : sbcs', function() +AHs chkde(708, Buffer+AF8-from(+AFs-0xca, 0x20, 0x61, 0x6e, 0x64, 0x20, 0xcb, 0x20, 0x73, 0x6d, 0x69, 0x6c, 0x65, 0x79, 0x20, 0x66, 0x61, 0x63, 0x65, 0x73+AF0))+ADs +AH0)+ADs /+ACo (+ACIGKg and +Bis smiley faces+ACI) +ACo-/
|
||||
it('CP 936 : dbcs', function() +AHs chkde(936, +AFs-0xd5, 0xe2, 0xca, 0xc7, 0xd6, 0xd0, 0xce, 0xc4, 0xd7, 0xd6, 0xb7, 0xfb, 0xb2, 0xe2, 0xca, 0xd4+AF0)+ADsAfQ)+ADs /+ACo +ACKP2WYvTi1lh1tXeyZtS4vVACI +ACo-/
|
||||
+AH0)+ADs
|
||||
+AH0)+ADs
|
||||
@ -754,7 +771,7 @@ describe('failures', function() +AHs
|
||||
+AGAAYABg-json+AD4-package.json
|
||||
+AHs
|
||||
+ACI-name+ACI: +ACI-codepage+ACI,
|
||||
+ACI-version+ACI: +ACI-1.13.0+ACI,
|
||||
+ACI-version+ACI: +ACI-1.14.0+ACI,
|
||||
+ACI-author+ACI: +ACI-SheetJS+ACI,
|
||||
+ACI-description+ACI: +ACI-pure-JS library to handle codepages+ACI,
|
||||
+ACI-keywords+ACI: +AFs +ACI-codepage+ACI, +ACI-iconv+ACI, +ACI-convert+ACI, +ACI-strings+ACI +AF0,
|
||||
@ -807,6 +824,7 @@ describe('failures', function() +AHs
|
||||
+ACI-LICENSE+ACI,
|
||||
+ACI-README.md+ACI,
|
||||
+ACI-bin+ACI,
|
||||
+ACI-bits/+ACo.js+ACI,
|
||||
+ACI-types/index.d.ts+ACI,
|
||||
+ACI-types/+ACo.json+ACI,
|
||||
+ACI-cptable.js+ACI,
|
||||
@ -825,10 +843,12 @@ describe('failures', function() +AHs
|
||||
+AGAAYABg
|
||||
|
||||
+AGAAYABgAD4.gitignore
|
||||
node+AF8-modules
|
||||
package-lock.json
|
||||
+ACo.tgz
|
||||
.gitignore
|
||||
codepages/
|
||||
.vocrc
|
||||
node+AF8-modules/
|
||||
make.sh
|
||||
make.njs
|
||||
misc/coverage.html
|
||||
|
@ -448,11 +448,28 @@ while the input format is automatically determined.
|
||||
|
||||
# Tests
|
||||
|
||||
The tests include JS validity tests (requiring or evaluating code):
|
||||
|
||||
```>test.js
|
||||
var fs = require('fs'), assert = require('assert'), vm = require('vm');
|
||||
var cptable, sbcs;
|
||||
|
||||
```
|
||||
|
||||
Due to a bug in `Buffer.from` in node `4.0 - 4.4`, a special check is needed:
|
||||
|
||||
```>test.js
|
||||
var Buffer_from = function(){};
|
||||
|
||||
if(typeof Buffer !== 'undefined') {
|
||||
var nbfs = !Buffer.from;
|
||||
if(!nbfs) try { Buffer.from("foo", "utf8"); } catch(e) { nbfs = true; }
|
||||
Buffer_from = nbfs ? function(buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); } : Buffer.from.bind(Buffer);
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
The tests include JS validity tests (requiring or evaluating code):
|
||||
|
||||
```>test.js
|
||||
describe('source', function() {
|
||||
it('should load node', function() { cptable = require('./'); });
|
||||
it('should load sbcs', function() { sbcs = require('./sbcs'); });
|
||||
@ -565,7 +582,7 @@ describe('entry conditions', function() {
|
||||
var arr = cptable.utils.encode(cp,i.split(""),e);
|
||||
assert.deepEqual(str,arr);
|
||||
if(typeof Buffer === 'undefined') return;
|
||||
var buf = cptable.utils.encode(cp,Buffer.from(i),e);
|
||||
var buf = cptable.utils.encode(cp,Buffer_from(i),e);
|
||||
assert.deepEqual(str,buf);
|
||||
};
|
||||
cptable.utils.cache.encache();
|
||||
@ -593,7 +610,7 @@ describe('entry conditions', function() {
|
||||
var arr = cptable.utils.decode(cp,s.join?s.join(""):s);
|
||||
assert.deepEqual(str,arr);
|
||||
if(typeof Buffer === 'undefined') return;
|
||||
var buf = cptable.utils.decode(cp,Buffer.from(i));
|
||||
var buf = cptable.utils.decode(cp,Buffer_from(i));
|
||||
assert.deepEqual(str,buf);
|
||||
};
|
||||
cptable.utils.cache.encache();
|
||||
@ -603,7 +620,7 @@ describe('entry conditions', function() {
|
||||
};
|
||||
describe('decode', function() {
|
||||
it('CP 1252 : sbcs', function() { chkde(1252,[0x66, 0x6f, 0x6f, 0x62, 0x61, 0x72]); }); /* "foobar" */
|
||||
if(typeof Buffer !== 'undefined') it('CP 708 : sbcs', function() { chkde(708, Buffer.from([0xca, 0x20, 0x61, 0x6e, 0x64, 0x20, 0xcb, 0x20, 0x73, 0x6d, 0x69, 0x6c, 0x65, 0x79, 0x20, 0x66, 0x61, 0x63, 0x65, 0x73])); }); /* ("ت and ث smiley faces") */
|
||||
if(typeof Buffer !== 'undefined') it('CP 708 : sbcs', function() { chkde(708, Buffer_from([0xca, 0x20, 0x61, 0x6e, 0x64, 0x20, 0xcb, 0x20, 0x73, 0x6d, 0x69, 0x6c, 0x65, 0x79, 0x20, 0x66, 0x61, 0x63, 0x65, 0x73])); }); /* ("ت and ث smiley faces") */
|
||||
it('CP 936 : dbcs', function() { chkde(936, [0xd5, 0xe2, 0xca, 0xc7, 0xd6, 0xd0, 0xce, 0xc4, 0xd7, 0xd6, 0xb7, 0xfb, 0xb2, 0xe2, 0xca, 0xd4]);}); /* "这是中文字符测试" */
|
||||
});
|
||||
});
|
||||
@ -754,7 +771,7 @@ describe('failures', function() {
|
||||
```json>package.json
|
||||
{
|
||||
"name": "codepage",
|
||||
"version": "1.13.0",
|
||||
"version": "1.14.0",
|
||||
"author": "SheetJS",
|
||||
"description": "pure-JS library to handle codepages",
|
||||
"keywords": [ "codepage", "iconv", "convert", "strings" ],
|
||||
@ -807,6 +824,7 @@ describe('failures', function() {
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
"bin",
|
||||
"bits/*.js",
|
||||
"types/index.d.ts",
|
||||
"types/*.json",
|
||||
"cptable.js",
|
||||
@ -825,10 +843,12 @@ describe('failures', function() {
|
||||
```
|
||||
|
||||
```>.gitignore
|
||||
node_modules
|
||||
package-lock.json
|
||||
*.tgz
|
||||
.gitignore
|
||||
codepages/
|
||||
.vocrc
|
||||
node_modules/
|
||||
make.sh
|
||||
make.njs
|
||||
misc/coverage.html
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* cptable.js (C) 2013-present SheetJS -- http://sheetjs.com */
|
||||
/*jshint -W100 */
|
||||
var cptable = {version:"1.13.0"};
|
||||
var cptable = {version:"1.14.0"};
|
||||
cptable[37] = (function(){ var d = "\u0000\u0001\u0002\u0003\t\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\b\u0018\u0019\u001c\u001d\u001e\u001f\n\u0017\u001b\u0005\u0006\u0007\u0016\u0004\u0014\u0015\u001a .<(+|&!$*);-/,%_>?`:#@'=\"abcdefghijklmnopqr~stuvwxyz^[]{ABCDEFGHI}JKLMNOPQR\\STUVWXYZ0123456789", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
cptable[437] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
cptable[500] = (function(){ var d = "\u0000\u0001\u0002\u0003\t\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\b\u0018\u0019\u001c\u001d\u001e\u001f\n\u0017\u001b\u0005\u0006\u0007\u0016\u0004\u0014\u0015\u001a [.<(+!&]$*);^-/,%_>?`:#@'=\"abcdefghijklmnopqr~stuvwxyz|{ABCDEFGHI}JKLMNOPQR\\STUVWXYZ0123456789", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
/+ACo cptable.js (C) 2013-present SheetJS -- http://sheetjs.com +ACo-/
|
||||
/+ACo-jshint -W100 +ACo-/
|
||||
var cptable +AD0 +AHs-version:+ACI-1.13.0+ACIAfQA7
|
||||
var cptable +AD0 +AHs-version:+ACI-1.14.0+ACIAfQA7
|
||||
cptable+AFs-37+AF0 +AD0 (function()+AHs var d +AD0 +ACIAXA-u0000+AFw-u0001+AFw-u0002+AFw-u0003+AJwAXA-t+AIYAfwCXAI0AjgBc-u000b+AFw-f+AFw-r+AFw-u000e+AFw-u000f+AFw-u0010+AFw-u0011+AFw-u0012+AFw-u0013+AJ0AhQBc-b+AIcAXA-u0018+AFw-u0019+AJIAjwBc-u001c+AFw-u001d+AFw-u001e+AFw-u001f+AIAAgQCCAIMAhABc-n+AFw-u0017+AFw-u001b+AIgAiQCKAIsAjABc-u0005+AFw-u0006+AFw-u0007+AJAAkQBc-u0016+AJMAlACVAJYAXA-u0004+AJgAmQCaAJsAXA-u0014+AFw-u0015+AJ4AXA-u001a +AKAA4gDkAOAA4QDjAOUA5wDxAKI.+ADw(+-+AHwAJgDpAOoA6wDoAO0A7gDvAOwA3wAhACQAKg)+ADsArA--/+AMIAxADAAMEAwwDFAMcA0QCm,+ACUAXwA+?+APgAyQDKAMsAyADNAM4AzwDMAGA:+ACMAQA'+AD0AXAAiANg-abcdefghi+AKsAuwDwAP0A/gCxALA-jklmnopqr+AKoAugDmALgAxgCkALUAfg-stuvwxyz+AKEAvwDQAN0A3gCuAF4AowClALcAqQCnALYAvAC9AL4AWwBdAK8AqAC0ANcAew-ABCDEFGHI+AK0A9AD2APIA8wD1AH0-JKLMNOPQR+ALkA+wD8APkA+gD/AFwAXAD3-STUVWXYZ+ALIA1ADWANIA0wDV-0123456789+ALMA2wDcANkA2gCfACI, D +AD0 +AFsAXQ, e +AD0 +AHsAfQA7 for(var i+AD0-0+ADs-i+ACEAPQ-d.length+ADsAKwAr-i) +AHs if(d.charCodeAt(i) +ACEAPQA9 0xFFFD) e+AFs-d.charAt(i)+AF0 +AD0 i+ADs D+AFs-i+AF0 +AD0 d.charAt(i)+ADs +AH0 return +AHsAIg-enc+ACI: e, +ACI-dec+ACI: D +AH0AOw +AH0)()+ADs
|
||||
cptable+AFs-437+AF0 +AD0 (function()+AHs var d +AD0 +ACIAXA-u0000+AFw-u0001+AFw-u0002+AFw-u0003+AFw-u0004+AFw-u0005+AFw-u0006+AFw-u0007+AFw-b+AFw-t+AFw-n+AFw-u000b+AFw-f+AFw-r+AFw-u000e+AFw-u000f+AFw-u0010+AFw-u0011+AFw-u0012+AFw-u0013+AFw-u0014+AFw-u0015+AFw-u0016+AFw-u0017+AFw-u0018+AFw-u0019+AFw-u001a+AFw-u001b+AFw-u001c+AFw-u001d+AFw-u001e+AFw-u001f +ACEAXAAiACMAJAAlACY'()+ACoAKw,-./0123456789:+ADsAPAA9AD4?+AEA-ABCDEFGHIJKLMNOPQRSTUVWXYZ+AFsAXABcAF0AXgBfAGA-abcdefghijklmnopqrstuvwxyz+AHsAfAB9AH4AfwDHAPwA6QDiAOQA4ADlAOcA6gDrAOgA7wDuAOwAxADFAMkA5gDGAPQA9gDyAPsA+QD/ANYA3ACiAKMApSCnAZIA4QDtAPMA+gDxANEAqgC6AL8jEACsAL0AvAChAKsAuyWRJZIlkyUCJSQlYSViJVYlVSVjJVElVyVdJVwlWyUQJRQlNCUsJRwlACU8JV4lXyVaJVQlaSVmJWAlUCVsJWclaCVkJWUlWSVYJVIlUyVrJWolGCUMJYglhCWMJZAlgAOxAN8DkwPAA6MDwwC1A8QDpgOYA6kDtCIeA8YDtSIpImEAsSJlImQjICMhAPciSACwIhkAtyIaIH8AsiWgAKAAIg, D +AD0 +AFsAXQ, e +AD0 +AHsAfQA7 for(var i+AD0-0+ADs-i+ACEAPQ-d.length+ADsAKwAr-i) +AHs if(d.charCodeAt(i) +ACEAPQA9 0xFFFD) e+AFs-d.charAt(i)+AF0 +AD0 i+ADs D+AFs-i+AF0 +AD0 d.charAt(i)+ADs +AH0 return +AHsAIg-enc+ACI: e, +ACI-dec+ACI: D +AH0AOw +AH0)()+ADs
|
||||
cptable+AFs-500+AF0 +AD0 (function()+AHs var d +AD0 +ACIAXA-u0000+AFw-u0001+AFw-u0002+AFw-u0003+AJwAXA-t+AIYAfwCXAI0AjgBc-u000b+AFw-f+AFw-r+AFw-u000e+AFw-u000f+AFw-u0010+AFw-u0011+AFw-u0012+AFw-u0013+AJ0AhQBc-b+AIcAXA-u0018+AFw-u0019+AJIAjwBc-u001c+AFw-u001d+AFw-u001e+AFw-u001f+AIAAgQCCAIMAhABc-n+AFw-u0017+AFw-u001b+AIgAiQCKAIsAjABc-u0005+AFw-u0006+AFw-u0007+AJAAkQBc-u0016+AJMAlACVAJYAXA-u0004+AJgAmQCaAJsAXA-u0014+AFw-u0015+AJ4AXA-u001a +AKAA4gDkAOAA4QDjAOUA5wDxAFs.+ADw(+-+ACEAJgDpAOoA6wDoAO0A7gDvAOwA3wBdACQAKg)+ADsAXg--/+AMIAxADAAMEAwwDFAMcA0QCm,+ACUAXwA+?+APgAyQDKAMsAyADNAM4AzwDMAGA:+ACMAQA'+AD0AXAAiANg-abcdefghi+AKsAuwDwAP0A/gCxALA-jklmnopqr+AKoAugDmALgAxgCkALUAfg-stuvwxyz+AKEAvwDQAN0A3gCuAKIAowClALcAqQCnALYAvAC9AL4ArAB8AK8AqAC0ANcAew-ABCDEFGHI+AK0A9AD2APIA8wD1AH0-JKLMNOPQR+ALkA+wD8APkA+gD/AFwAXAD3-STUVWXYZ+ALIA1ADWANIA0wDV-0123456789+ALMA2wDcANkA2gCfACI, D +AD0 +AFsAXQ, e +AD0 +AHsAfQA7 for(var i+AD0-0+ADs-i+ACEAPQ-d.length+ADsAKwAr-i) +AHs if(d.charCodeAt(i) +ACEAPQA9 0xFFFD) e+AFs-d.charAt(i)+AF0 +AD0 i+ADs D+AFs-i+AF0 +AD0 d.charAt(i)+ADs +AH0 return +AHsAIg-enc+ACI: e, +ACI-dec+ACI: D +AH0AOw +AH0)()+ADs
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* cptable.js (C) 2013-present SheetJS -- http://sheetjs.com */
|
||||
/*jshint -W100 */
|
||||
var cptable = {version:"1.13.0"};
|
||||
var cptable = {version:"1.14.0"};
|
||||
cptable[37] = (function(){ var d = "\u0000\u0001\u0002\u0003\t\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013
\b\u0018\u0019\u001c\u001d\u001e\u001f\n\u0017\u001b\u0005\u0006\u0007\u0016\u0004\u0014\u0015\u001a âäàáãåçñ¢.<(+|&éêëèíîïìß!$*);¬-/ÂÄÀÁÃÅÇѦ,%_>?øÉÊËÈÍÎÏÌ`:#@'=\"Øabcdefghi«»ðýþ±°jklmnopqrªºæ¸Æ¤µ~stuvwxyz¡¿ÐÝÞ®^£¥·©§¶¼½¾[]¯¨´×{ABCDEFGHIôöòóõ}JKLMNOPQR¹ûüùúÿ\\÷STUVWXYZ²ÔÖÒÓÕ0123456789³ÛÜÙÚ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
cptable[437] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
cptable[500] = (function(){ var d = "\u0000\u0001\u0002\u0003\t\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013
\b\u0018\u0019\u001c\u001d\u001e\u001f\n\u0017\u001b\u0005\u0006\u0007\u0016\u0004\u0014\u0015\u001a âäàáãåçñ[.<(+!&éêëèíîïìß]$*);^-/ÂÄÀÁÃÅÇѦ,%_>?øÉÊËÈÍÎÏÌ`:#@'=\"Øabcdefghi«»ðýþ±°jklmnopqrªºæ¸Æ¤µ~stuvwxyz¡¿ÐÝÞ®¢£¥·©§¶¼½¾¬|¯¨´×{ABCDEFGHIôöòóõ}JKLMNOPQR¹ûüùúÿ\\÷STUVWXYZ²ÔÖÒÓÕ0123456789³ÛÜÙÚ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
|
@ -40,9 +40,11 @@
|
||||
var cca = function cca(x) { return x.charCodeAt(0); };
|
||||
|
||||
var has_buf = (typeof Buffer !== 'undefined');
|
||||
var Buffer_from = function(){};
|
||||
if(has_buf) {
|
||||
// $FlowIgnore
|
||||
if(!Buffer.from) Buffer.from = function(buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); };
|
||||
var nbfs = !Buffer.from;
|
||||
if(!nbfs) try { Buffer.from("foo", "utf8"); } catch(e) { nbfs = true; }
|
||||
Buffer_from = nbfs ? function(buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); } : Buffer.from.bind(Buffer);
|
||||
// $FlowIgnore
|
||||
if(!Buffer.allocUnsafe) Buffer.allocUnsafe = function(n) { return new Buffer(n); };
|
||||
|
||||
@ -315,7 +317,7 @@
|
||||
}
|
||||
else if((M=magic[cp])) switch(M) {
|
||||
case "utf8":
|
||||
if(has_buf && isstr) { out = Buffer.from(data, M); j = out.length; break; }
|
||||
if(has_buf && isstr) { out = Buffer_from(data, M); j = out.length; break; }
|
||||
for(i = 0; i < len; ++i, ++j) {
|
||||
w = isstr ? data.charCodeAt(i) : data[i].charCodeAt(0);
|
||||
if(w <= 0x007F) out[j] = w;
|
||||
@ -337,7 +339,7 @@
|
||||
}
|
||||
break;
|
||||
case "ascii":
|
||||
if(has_buf && typeof data === "string") { out = Buffer.from(data, M); j = out.length; break; }
|
||||
if(has_buf && typeof data === "string") { out = Buffer_from(data, M); j = out.length; break; }
|
||||
for(i = 0; i < len; ++i, ++j) {
|
||||
w = isstr ? data.charCodeAt(i) : data[i].charCodeAt(0);
|
||||
if(w <= 0x007F) out[j] = w;
|
||||
@ -345,7 +347,7 @@
|
||||
}
|
||||
break;
|
||||
case "utf16le":
|
||||
if(has_buf && typeof data === "string") { out = Buffer.from(data, M); j = out.length; break; }
|
||||
if(has_buf && typeof data === "string") { out = Buffer_from(data, M); j = out.length; break; }
|
||||
for(i = 0; i < len; ++i) {
|
||||
w = isstr ? data.charCodeAt(i) : data[i].charCodeAt(0);
|
||||
out[j++] = w&255;
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -40,9 +40,11 @@
|
||||
var cca +AD0 function cca(x) +AHs return x.charCodeAt(0)+ADs +AH0AOw
|
||||
|
||||
var has+AF8-buf +AD0 (typeof Buffer +ACEAPQA9 'undefined')+ADs
|
||||
var Buffer+AF8-from +AD0 function()+AHsAfQA7
|
||||
if(has+AF8-buf) +AHs
|
||||
// +ACQ-FlowIgnore
|
||||
if(+ACE-Buffer.from) Buffer.from +AD0 function(buf, enc) +AHs return (enc) ? new Buffer(buf, enc) : new Buffer(buf)+ADs +AH0AOw
|
||||
var nbfs +AD0 +ACE-Buffer.from+ADs
|
||||
if(+ACE-nbfs) try +AHs Buffer.from(+ACI-foo+ACI, +ACI-utf8+ACI)+ADs +AH0 catch(e) +AHs nbfs +AD0 true+ADs +AH0
|
||||
Buffer+AF8-from +AD0 nbfs ? function(buf, enc) +AHs return (enc) ? new Buffer(buf, enc) : new Buffer(buf)+ADs +AH0 : Buffer.from.bind(Buffer)+ADs
|
||||
// +ACQ-FlowIgnore
|
||||
if(+ACE-Buffer.allocUnsafe) Buffer.allocUnsafe +AD0 function(n) +AHs return new Buffer(n)+ADs +AH0AOw
|
||||
|
||||
@ -315,7 +317,7 @@
|
||||
+AH0
|
||||
else if((M+AD0-magic+AFs-cp+AF0)) switch(M) +AHs
|
||||
case +ACI-utf8+ACI:
|
||||
if(has+AF8-buf +ACYAJg isstr) +AHs out +AD0 Buffer.from(data, M)+ADs j +AD0 out.length+ADs break+ADs +AH0
|
||||
if(has+AF8-buf +ACYAJg isstr) +AHs out +AD0 Buffer+AF8-from(data, M)+ADs j +AD0 out.length+ADs break+ADs +AH0
|
||||
for(i +AD0 0+ADs i +ADw len+ADs +-+-i, +-+-j) +AHs
|
||||
w +AD0 isstr ? data.charCodeAt(i) : data+AFs-i+AF0.charCodeAt(0)+ADs
|
||||
if(w +ADwAPQ 0x007F) out+AFs-j+AF0 +AD0 w+ADs
|
||||
@ -337,7 +339,7 @@
|
||||
+AH0
|
||||
break+ADs
|
||||
case +ACI-ascii+ACI:
|
||||
if(has+AF8-buf +ACYAJg typeof data +AD0APQA9 +ACI-string+ACI) +AHs out +AD0 Buffer.from(data, M)+ADs j +AD0 out.length+ADs break+ADs +AH0
|
||||
if(has+AF8-buf +ACYAJg typeof data +AD0APQA9 +ACI-string+ACI) +AHs out +AD0 Buffer+AF8-from(data, M)+ADs j +AD0 out.length+ADs break+ADs +AH0
|
||||
for(i +AD0 0+ADs i +ADw len+ADs +-+-i, +-+-j) +AHs
|
||||
w +AD0 isstr ? data.charCodeAt(i) : data+AFs-i+AF0.charCodeAt(0)+ADs
|
||||
if(w +ADwAPQ 0x007F) out+AFs-j+AF0 +AD0 w+ADs
|
||||
@ -345,7 +347,7 @@
|
||||
+AH0
|
||||
break+ADs
|
||||
case +ACI-utf16le+ACI:
|
||||
if(has+AF8-buf +ACYAJg typeof data +AD0APQA9 +ACI-string+ACI) +AHs out +AD0 Buffer.from(data, M)+ADs j +AD0 out.length+ADs break+ADs +AH0
|
||||
if(has+AF8-buf +ACYAJg typeof data +AD0APQA9 +ACI-string+ACI) +AHs out +AD0 Buffer+AF8-from(data, M)+ADs j +AD0 out.length+ADs break+ADs +AH0
|
||||
for(i +AD0 0+ADs i +ADw len+ADs +-+-i) +AHs
|
||||
w +AD0 isstr ? data.charCodeAt(i) : data+AFs-i+AF0.charCodeAt(0)+ADs
|
||||
out+AFs-j+-+-+AF0 +AD0 w+ACY-255+ADs
|
||||
|
@ -40,9 +40,11 @@
|
||||
var cca = function cca(x) { return x.charCodeAt(0); };
|
||||
|
||||
var has_buf = (typeof Buffer !== 'undefined');
|
||||
var Buffer_from = function(){};
|
||||
if(has_buf) {
|
||||
// $FlowIgnore
|
||||
if(!Buffer.from) Buffer.from = function(buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); };
|
||||
var nbfs = !Buffer.from;
|
||||
if(!nbfs) try { Buffer.from("foo", "utf8"); } catch(e) { nbfs = true; }
|
||||
Buffer_from = nbfs ? function(buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); } : Buffer.from.bind(Buffer);
|
||||
// $FlowIgnore
|
||||
if(!Buffer.allocUnsafe) Buffer.allocUnsafe = function(n) { return new Buffer(n); };
|
||||
|
||||
@ -315,7 +317,7 @@
|
||||
}
|
||||
else if((M=magic[cp])) switch(M) {
|
||||
case "utf8":
|
||||
if(has_buf && isstr) { out = Buffer.from(data, M); j = out.length; break; }
|
||||
if(has_buf && isstr) { out = Buffer_from(data, M); j = out.length; break; }
|
||||
for(i = 0; i < len; ++i, ++j) {
|
||||
w = isstr ? data.charCodeAt(i) : data[i].charCodeAt(0);
|
||||
if(w <= 0x007F) out[j] = w;
|
||||
@ -337,7 +339,7 @@
|
||||
}
|
||||
break;
|
||||
case "ascii":
|
||||
if(has_buf && typeof data === "string") { out = Buffer.from(data, M); j = out.length; break; }
|
||||
if(has_buf && typeof data === "string") { out = Buffer_from(data, M); j = out.length; break; }
|
||||
for(i = 0; i < len; ++i, ++j) {
|
||||
w = isstr ? data.charCodeAt(i) : data[i].charCodeAt(0);
|
||||
if(w <= 0x007F) out[j] = w;
|
||||
@ -345,7 +347,7 @@
|
||||
}
|
||||
break;
|
||||
case "utf16le":
|
||||
if(has_buf && typeof data === "string") { out = Buffer.from(data, M); j = out.length; break; }
|
||||
if(has_buf && typeof data === "string") { out = Buffer_from(data, M); j = out.length; break; }
|
||||
for(i = 0; i < len; ++i) {
|
||||
w = isstr ? data.charCodeAt(i) : data[i].charCodeAt(0);
|
||||
out[j++] = w&255;
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "codepage",
|
||||
"version": "1.13.0",
|
||||
"version": "1.14.0",
|
||||
"author": "SheetJS",
|
||||
"description": "pure-JS library to handle codepages",
|
||||
"keywords": [ "codepage", "iconv", "convert", "strings" ],
|
||||
@ -53,6 +53,7 @@
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
"bin",
|
||||
"bits/*.js",
|
||||
"types/index.d.ts",
|
||||
"types/*.json",
|
||||
"cptable.js",
|
||||
|
2
sbcs.js
2
sbcs.js
@ -1,6 +1,6 @@
|
||||
/* sbcs.js (C) 2013-present SheetJS -- http://sheetjs.com */
|
||||
/*jshint -W100 */
|
||||
var cptable = {version:"1.13.0"};
|
||||
var cptable = {version:"1.14.0"};
|
||||
cptable[37] = (function(){ var d = "\u0000\u0001\u0002\u0003\t\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013
\b\u0018\u0019\u001c\u001d\u001e\u001f\n\u0017\u001b\u0005\u0006\u0007\u0016\u0004\u0014\u0015\u001a âäàáãåçñ¢.<(+|&éêëèíîïìß!$*);¬-/ÂÄÀÁÃÅÇѦ,%_>?øÉÊËÈÍÎÏÌ`:#@'=\"Øabcdefghi«»ðýþ±°jklmnopqrªºæ¸Æ¤µ~stuvwxyz¡¿ÐÝÞ®^£¥·©§¶¼½¾[]¯¨´×{ABCDEFGHIôöòóõ}JKLMNOPQR¹ûüùúÿ\\÷STUVWXYZ²ÔÖÒÓÕ0123456789³ÛÜÙÚ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
cptable[437] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
cptable[500] = (function(){ var d = "\u0000\u0001\u0002\u0003\t\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013
\b\u0018\u0019\u001c\u001d\u001e\u001f\n\u0017\u001b\u0005\u0006\u0007\u0016\u0004\u0014\u0015\u001a âäàáãåçñ[.<(+!&éêëèíîïìß]$*);^-/ÂÄÀÁÃÅÇѦ,%_>?øÉÊËÈÍÎÏÌ`:#@'=\"Øabcdefghi«»ðýþ±°jklmnopqrªºæ¸Æ¤µ~stuvwxyz¡¿ÐÝÞ®¢£¥·©§¶¼½¾¬|¯¨´×{ABCDEFGHIôöòóõ}JKLMNOPQR¹ûüùúÿ\\÷STUVWXYZ²ÔÖÒÓÕ0123456789³ÛÜÙÚ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
|
13
test.js
13
test.js
@ -1,5 +1,12 @@
|
||||
var fs = require('fs'), assert = require('assert'), vm = require('vm');
|
||||
var cptable, sbcs;
|
||||
var Buffer_from = function(){};
|
||||
|
||||
if(typeof Buffer !== 'undefined') {
|
||||
var nbfs = !Buffer.from;
|
||||
if(!nbfs) try { Buffer.from("foo", "utf8"); } catch(e) { nbfs = true; }
|
||||
Buffer_from = nbfs ? function(buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); } : Buffer.from.bind(Buffer);
|
||||
}
|
||||
describe('source', function() {
|
||||
it('should load node', function() { cptable = require('./'); });
|
||||
it('should load sbcs', function() { sbcs = require('./sbcs'); });
|
||||
@ -97,7 +104,7 @@ describe('entry conditions', function() {
|
||||
var arr = cptable.utils.encode(cp,i.split(""),e);
|
||||
assert.deepEqual(str,arr);
|
||||
if(typeof Buffer === 'undefined') return;
|
||||
var buf = cptable.utils.encode(cp,Buffer.from(i),e);
|
||||
var buf = cptable.utils.encode(cp,Buffer_from(i),e);
|
||||
assert.deepEqual(str,buf);
|
||||
};
|
||||
cptable.utils.cache.encache();
|
||||
@ -125,7 +132,7 @@ describe('entry conditions', function() {
|
||||
var arr = cptable.utils.decode(cp,s.join?s.join(""):s);
|
||||
assert.deepEqual(str,arr);
|
||||
if(typeof Buffer === 'undefined') return;
|
||||
var buf = cptable.utils.decode(cp,Buffer.from(i));
|
||||
var buf = cptable.utils.decode(cp,Buffer_from(i));
|
||||
assert.deepEqual(str,buf);
|
||||
};
|
||||
cptable.utils.cache.encache();
|
||||
@ -135,7 +142,7 @@ describe('entry conditions', function() {
|
||||
};
|
||||
describe('decode', function() {
|
||||
it('CP 1252 : sbcs', function() { chkde(1252,[0x66, 0x6f, 0x6f, 0x62, 0x61, 0x72]); }); /* "foobar" */
|
||||
if(typeof Buffer !== 'undefined') it('CP 708 : sbcs', function() { chkde(708, Buffer.from([0xca, 0x20, 0x61, 0x6e, 0x64, 0x20, 0xcb, 0x20, 0x73, 0x6d, 0x69, 0x6c, 0x65, 0x79, 0x20, 0x66, 0x61, 0x63, 0x65, 0x73])); }); /* ("ت and ث smiley faces") */
|
||||
if(typeof Buffer !== 'undefined') it('CP 708 : sbcs', function() { chkde(708, Buffer_from([0xca, 0x20, 0x61, 0x6e, 0x64, 0x20, 0xcb, 0x20, 0x73, 0x6d, 0x69, 0x6c, 0x65, 0x79, 0x20, 0x66, 0x61, 0x63, 0x65, 0x73])); }); /* ("ت and ث smiley faces") */
|
||||
it('CP 936 : dbcs', function() { chkde(936, [0xd5, 0xe2, 0xca, 0xc7, 0xd6, 0xd0, 0xce, 0xc4, 0xd7, 0xd6, 0xb7, 0xfb, 0xb2, 0xe2, 0xca, 0xd4]);}); /* "这是中文字符测试" */
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user