diff --git a/README.md b/README.md index 96cb96c..d40cfba 100644 --- a/README.md +++ b/README.md @@ -199,6 +199,7 @@ hardcoded in utils, there is no corresponding entry (they are "magic") |20936|MakeEncoding.cs|Simplified Chinese (GB2312-80) |20949|MakeEncoding.cs|Korean Wansung |21025|MakeEncoding.cs|IBM EBCDIC Cyrillic Serbian-Bulgarian +|21027| NLS |Extended/Ext Alpha Lowercase |21866|MakeEncoding.cs|Ukrainian Cyrillic (KOI8-U) |28591| unicode.org |ISO 8859-1 Latin 1 (Western European) |28592| unicode.org |ISO 8859-2 Latin 2 (Central European) @@ -254,7 +255,6 @@ ISO-8869-6 when in fact there are many differences), so all implementations - 709 Arabic (ASMO-449+, BCON V4) - 710 Arabic - Transparent Arabic -- 21027 (deprecated) <-- is this necessary? - 50229 ISO 2022 Traditional Chinese - 50930 EBCDIC Japanese (Katakana) Extended - 50931 EBCDIC US-Canada and Japanese diff --git a/bin/codepage.njs b/bin/codepage.njs index fab51ec..8c8abcc 100755 --- a/bin/codepage.njs +++ b/bin/codepage.njs @@ -4,11 +4,12 @@ var codepage = require('../'); var fs = require('fs'), program = require('commander'); program - .version('1.0.0') + .version(codepage.version) .usage('[options] ') .option('-f, --from-code ', 'codepage of input (default 65001 utf8)') .option('-t, --to-code ', 'codepage of output (default 65001 utf8)') .option('-o, --output ', 'output file (. if specified)') + .option('-B, --bom', 'write BOM (for unicode codepages)') .option('-l, --list', 'List supported codepages'); program.on('--help', function() { @@ -19,6 +20,11 @@ program.on('--help', function() { program.parse(process.argv); +if(program.list) { + Object.keys(codepage).forEach(function(x) { if(+x == x) console.log(x); }); + process.exit(); +} + if(!fs.existsSync(program.args[0])) { console.error('codepage: must specify a filename'); process.exit(13); @@ -30,6 +36,20 @@ var f = program.args[0]; var o = program.output; var text = fs.readFileSync(f); var dec = codepage.utils.decode(fr, text); -if(o) fs.writeFileSync(o, codepage.utils.encode(to, dec)); -else if(!program.toCode) console.log(dec.toString('utf8')); -else fs.writeFileSync(f + "." + to, codepage.utils.encode(to, dec)); + +var bom = { + 1200: new Buffer([0xFF, 0xFE]), + 1201: new Buffer([0xFE, 0xFF]), + 12000: new Buffer([0xFF, 0xFE, 0x00, 0x00]), + 12001: new Buffer([0x00, 0x00, 0xFE, 0xFF]), + 16969: new Buffer([0x69, 0x69]), + 65000: new Buffer([0x2B, 0x2F, 0x76, 0x2B]), + 65001: new Buffer([0xEF, 0xBB, 0xBF]) +} + +if(!program.toCode && !o) console.log(dec.toString('utf8')); +else if(!program.bom || !bom[fr]) fs.writeFileSync(o || (f + "." + to), codepage.utils.encode(to, dec)); +else { + fs.writeFileSync(o || (f + "." + to), bom[fr]); + fs.appendFileSync(o || (f + "." + to), codepage.utils.encode(to, dec)); +} diff --git a/bits/21027.js b/bits/21027.js new file mode 100644 index 0000000..16db328 --- /dev/null +++ b/bits/21027.js @@ -0,0 +1,2 @@ +if(typeof cptable === 'undefined') cptable = {}; +cptable[21027] = (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\u0000 \u0000。「」、・ヲァィ¢.<(+|&ゥェォャュョッーア!$*);¬-/イウエオカキケ\u0000,%_>?コサシスセソタチツ`:#@'\"\u0000abcdefghiテトナニŽネ\u0000jklmnopqrノハヒフヘホ¯~stuvwxyzマミム[メモ^£¥ヤユヨラリルレロワン]゙゚{ABCDEFG\u0000\u0000}JKLMNOP\u0000\\\u0000STUVWX\u0000\u000001234567", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); diff --git a/codepage.md b/codepage.md index b59a1b7..97b3fc7 100644 --- a/codepage.md +++ b/codepage.md @@ -137,6 +137,7 @@ The following codepages are available in .NET on Windows: - 20936 Simplified Chinese (GB2312); Chinese Simplified (GB2312-80) - 20949 Korean Wansung - 21025 IBM EBCDIC Cyrillic Serbian-Bulgarian +- 21027 Extended/Ext Alpha Lowercase - 21866 Ukrainian (KOI8-U); Cyrillic (KOI8-U) - 29001 Europa 3 - 38598 ISO 8859-8 Hebrew; Hebrew (ISO-Logical) @@ -222,6 +223,7 @@ The following codepages are available in .NET on Windows: 20936,,2 20949,,2 21025,,1 +21027,,1 21866,,1 29001,,1 38598,,1 @@ -389,12 +391,13 @@ elements (like `0x7F` for CP 10000) are removed. INFILE=${1:-pages.csv} OUTFILE=${2:-cptable.js} JSVAR=${3:-cptable} +VERSION=$(cat package.json | grep version | tr -dc [0-9.]) mkdir -p codepages bits rm -f $OUTFILE $OUTFILE.tmp echo "/* $OUTFILE (C) 2013-2014 SheetJS -- http://sheetjs.com */" > $OUTFILE.tmp echo "/*jshint -W100 */" >> $OUTFILE.tmp -echo "var $JSVAR = {};" >> $OUTFILE.tmp +echo "var $JSVAR = {version:\"$VERSION\"};" >> $OUTFILE.tmp if [ -e dotnet.sh ]; then bash dotnet.sh; fi awk -F, '{print $1, $2, $3}' $INFILE | while read cp url cptype; do echo $cp $url @@ -510,8 +513,8 @@ describe('consistency', function() { cptable.utils.cache.encache(); }); }; }; - Object.keys(cptable).filter(function(w) { return w != "utils"; }).forEach(chk(cptable, true)); - Object.keys(cptable).filter(function(w) { return w != "utils"; }).forEach(chk(cptable, false)); + Object.keys(cptable).filter(function(w) { return w == +w; }).forEach(chk(cptable, true)); + Object.keys(cptable).filter(function(w) { return w == +w; }).forEach(chk(cptable, false)); }); ``` @@ -712,7 +715,7 @@ describe('failures', function() { ```json>package.json { "name": "codepage", - "version": "1.3.3", + "version": "1.3.4", "author": "SheetJS", "description": "pure-JS library to handle codepages", "keywords": [ "codepage", "iconv", "convert", "strings" ], diff --git a/codepages/21027.TBL b/codepages/21027.TBL new file mode 100644 index 0000000..b240213 --- /dev/null +++ b/codepages/21027.TBL @@ -0,0 +1,256 @@ +0x00 0x0000 +0x01 0x0001 +0x02 0x0002 +0x03 0x0003 +0x04 0x0004 +0x05 0x0005 +0x06 0x0006 +0x07 0x0007 +0x08 0x0008 +0x09 0x0009 +0x0A 0x000A +0x0B 0x000B +0x0C 0x000C +0x0D 0x000D +0x0E 0x000E +0x0F 0x000F +0x10 0x0010 +0x11 0x0011 +0x12 0x0012 +0x13 0x0013 +0x14 0x0014 +0x15 0x0015 +0x16 0x0016 +0x17 0x0017 +0x18 0x0018 +0x19 0x0019 +0x1A 0x001A +0x1B 0x001B +0x1C 0x001C +0x1D 0x001D +0x1E 0x001E +0x1F 0x001F +0x20 0xF8C4 +0x21 0xF8C5 +0x22 0xF8C6 +0x23 0xF8C7 +0x24 0xF8C8 +0x25 0xF8C9 +0x26 0xF8CA +0x27 0xF8CB +0x28 0xF8CC +0x29 0xF8CD +0x2A 0xF8CE +0x2B 0xF8CF +0x2C 0xF8D0 +0x2D 0xF8D1 +0x2E 0xF8D2 +0x2F 0xF8D3 +0x30 0xF8D4 +0x31 0xF8D5 +0x32 0xF8D6 +0x33 0xF8D7 +0x34 0xF8D8 +0x35 0xF8D9 +0x36 0xF8DA +0x37 0xF8DB +0x38 0xF8DC +0x39 0xF8DD +0x3A 0xF8DE +0x3B 0xF8DF +0x3C 0xF8E0 +0x3D 0xF8E1 +0x3E 0x0000 +0x3F 0xF8E2 +0x40 0x0020 +0x41 0x0000 +0x42 0xFF61 +0x43 0xFF62 +0x44 0xFF63 +0x45 0xFF64 +0x46 0xFF65 +0x47 0xFF66 +0x48 0xFF67 +0x49 0xFF68 +0x4A 0x00A2 +0x4B 0x002E +0x4C 0x003C +0x4D 0x0028 +0x4E 0x002B +0x4F 0x007C +0x50 0x0026 +0x51 0xFF69 +0x52 0xFF6A +0x53 0xFF6B +0x54 0xFF6C +0x55 0xFF6D +0x56 0xFF6E +0x57 0xFF6F +0x58 0xFF70 +0x59 0xFF71 +0x5A 0x0021 +0x5B 0x0024 +0x5C 0x002A +0x5D 0x0029 +0x5E 0x003B +0x5F 0x00AC +0x60 0x002D +0x61 0x002F +0x62 0xFF72 +0x63 0xFF73 +0x64 0xFF74 +0x65 0xFF75 +0x66 0xFF76 +0x67 0xFF77 +0x68 0xF8E3 +0x69 0xFF79 +0x6A 0x0000 +0x6B 0x002C +0x6C 0x0025 +0x6D 0x005F +0x6E 0x003E +0x6F 0x003F +0x70 0xFF7A +0x71 0xFF7B +0x72 0xFF7C +0x73 0xFF7D +0x74 0xFF7E +0x75 0xFF7F +0x76 0xFF80 +0x77 0xFF81 +0x78 0xFF82 +0x79 0x0060 +0x7A 0x003A +0x7B 0x0023 +0x7C 0x0040 +0x7D 0x0027 +0x7E 0xF8E4 +0x7F 0x0022 +0x80 0x0000 +0x81 0x0061 +0x82 0x0062 +0x83 0x0063 +0x84 0x0064 +0x85 0x0065 +0x86 0x0066 +0x87 0x0067 +0x88 0x0068 +0x89 0x0069 +0x8A 0xFF83 +0x8B 0xFF84 +0x8C 0xFF85 +0x8D 0xFF86 +0x8E 0x008E +0x8F 0xFF88 +0x90 0x0000 +0x91 0x006A +0x92 0x006B +0x93 0x006C +0x94 0x006D +0x95 0x006E +0x96 0x006F +0x97 0x0070 +0x98 0x0071 +0x99 0x0072 +0x9A 0xFF89 +0x9B 0xFF8A +0x9C 0xFF8B +0x9D 0xFF8C +0x9E 0xFF8D +0x9F 0xFF8E +0xA0 0x00AF +0xA1 0x007E +0xA2 0x0073 +0xA3 0x0074 +0xA4 0x0075 +0xA5 0x0076 +0xA6 0x0077 +0xA7 0x0078 +0xA8 0x0079 +0xA9 0x007A +0xAA 0xFF8F +0xAB 0xFF90 +0xAC 0xFF91 +0xAD 0x005B +0xAE 0xFF92 +0xAF 0xFF93 +0xB0 0x005E +0xB1 0x00A3 +0xB2 0x00A5 +0xB3 0xFF94 +0xB4 0xFF95 +0xB5 0xFF96 +0xB6 0xFF97 +0xB7 0xFF98 +0xB8 0xFF99 +0xB9 0xFF9A +0xBA 0xFF9B +0xBB 0xFF9C +0xBC 0xFF9D +0xBD 0x005D +0xBE 0xFF9E +0xBF 0xFF9F +0xC0 0x007B +0xC1 0x0041 +0xC2 0x0042 +0xC3 0x0043 +0xC4 0x0044 +0xC5 0x0045 +0xC6 0x0046 +0xC7 0x0047 +0xC8 0xF8E5 +0xC9 0xF8E6 +0xCA 0xF8E7 +0xCB 0xF8E8 +0xCC 0xF8E9 +0xCD 0xF8EA +0xCE 0x0000 +0xCF 0x0000 +0xD0 0x007D +0xD1 0x004A +0xD2 0x004B +0xD3 0x004C +0xD4 0x004D +0xD5 0x004E +0xD6 0x004F +0xD7 0x0050 +0xD8 0xF8EB +0xD9 0xF8EC +0xDA 0xF8ED +0xDB 0xF8EE +0xDC 0xF8EF +0xDD 0xF8F0 +0xDE 0x0000 +0xDF 0xF8F1 +0xE0 0x005C +0xE1 0x0000 +0xE2 0x0053 +0xE3 0x0054 +0xE4 0x0055 +0xE5 0x0056 +0xE6 0x0057 +0xE7 0x0058 +0xE8 0xF8F2 +0xE9 0xF8F3 +0xEA 0xF8F4 +0xEB 0xF8F5 +0xEC 0xF8F6 +0xED 0xF8F7 +0xEE 0x0000 +0xEF 0x0000 +0xF0 0x0030 +0xF1 0x0031 +0xF2 0x0032 +0xF3 0x0033 +0xF4 0x0034 +0xF5 0x0035 +0xF6 0x0036 +0xF7 0x0037 +0xF8 0xF8F8 +0xF9 0xF8F9 +0xFA 0xF8FA +0xFB 0xF8FB +0xFC 0xF8FC +0xFD 0xF8FD +0xFE 0xF8FE +0xFF 0xF8FF diff --git a/cpexcel.js b/cpexcel.js index 7ad4251..b3a000c 100644 --- a/cpexcel.js +++ b/cpexcel.js @@ -1,6 +1,6 @@ /* cpexcel.js (C) 2013-2014 SheetJS -- http://sheetjs.com */ /*jshint -W100 */ -var cptable = {}; +var cptable = {version:"1.3.4"}; cptable[874] = (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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[932] = (function(){ var d = [], e = {}, D = [], j; D[0] = "\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{|}~���������������������������������。「」、・ヲァィゥェォャュョッーアイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワン゙゚��������������������������������".split(""); @@ -789,6 +789,8 @@ cptable[1253] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006 cptable[1254] = (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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[1255] = (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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[1256] = (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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); +cptable[1257] = (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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); +cptable[1258] = (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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[10000] = (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{|}~ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[10006] = (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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[10007] = (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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); diff --git a/cptable.js b/cptable.js index 3f83c77..8caa6cf 100644 --- a/cptable.js +++ b/cptable.js @@ -1,6 +1,6 @@ /* cptable.js (C) 2013-2014 SheetJS -- http://sheetjs.com */ /*jshint -W100 */ -var cptable = {}; +var cptable = {version:"1.3.4"}; 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[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[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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); @@ -3586,6 +3586,7 @@ D[253] = "����������������������� for(j = 0; j != D[253].length; ++j) if(D[253][j].charCodeAt(0) !== 0xFFFD) { e[D[253][j]] = 64768 + j; d[64768 + j] = D[253][j];} return {"enc": e, "dec": d }; })(); cptable[21025] = (function(){ var d = "ŸŸ\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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); +cptable[21027] = (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\u0000 \u0000。「」、・ヲァィ¢.<(+|&ゥェォャュョッーア!$*);¬-/イウエオカキケ\u0000,%_>?コサシスセソタチツ`:#@'\"\u0000abcdefghiテトナニŽネ\u0000jklmnopqrノハヒフヘホ¯~stuvwxyzマミム[メモ^£¥ヤユヨラリルレロワン]゙゚{ABCDEFG\u0000\u0000}JKLMNOP\u0000\\\u0000STUVWX\u0000\u000001234567", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[21866] = (function(){ var d = "ЪЪ\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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[29001] = (function(){ var d = "ΈΉΊΌΎ°◘○◙♂♀♪♬☼▶◀↕‼¶§£Ώ↑↓→←Ë↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùΑÖÜøαØάΒáíóúñÑβΓγΔδΕεέΖζΗηή│ªÁÂÀΘθ║╗╝ΙΪ┐└º¡¿─΄ãÃ╚╔ιίϊ═ΐΚκΛÊλΜμÍΝν┘┌ΞξΟοόÓßÔΠõÕπΡρÚΣςσΤτΥΫυύϋΰΦφΧχΨ·ψΩωώ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[38598] = (function(){ var d = "\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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); diff --git a/cputils.js b/cputils.js index 435d8b4..eb9bef2 100644 --- a/cputils.js +++ b/cputils.js @@ -189,7 +189,9 @@ var len = data.length, w = 0, ww = 0; if(4 * len > mdl) { mdl = 4 * len; mdb = new Buffer(mdl); } mdb.length = 0; - for(var i = 0, j = 1, k = 0, D = 0; i < len; i+=j) { + var i = 0; + if(len >= 3 && data[0] == 0xEF) if(data[1] == 0xBB && data[2] == 0xBF) i = 3; + for(var j = 1, k = 0, D = 0; i < len; i+=j) { j = 1; D = data[i]; if(D < 128) w = D; else if(D < 224) { w=(D&31)*64+(data[i+1]&63); j=2; } @@ -404,7 +406,9 @@ } else if((M=magic[cp])) switch(M) { case "utf8": - for(i = 0; i < len; i+=j) { + i = 0; + if(len >= 3 && data[0] == 0xEF) if(data[1] == 0xBB && data[2] == 0xBF) i = 3; + for(; i < len; i+=j) { j = 1; if(data[i] < 128) w = data[i]; else if(data[i] < 224) { w=(data[i]&31)*64+(data[i+1]&63); j=2; } @@ -422,21 +426,27 @@ for(i = 0; i < len; i++) out[i] = String.fromCharCode(data[i]); k = len; break; case "utf16le": + i = 0; + if(len >= 2 && data[0] == 0xFF) if(data[1] == 0xFE) i = 2; if(typeof Buffer !== 'undefined' && Buffer.isBuffer(data)) return data.toString(M); j = 2; - for(i = 0; i < len; i+=j) { + for(; i < len; i+=j) { out[k++] = String.fromCharCode((data[i+1]<<8) + data[i]); } break; case "utf16be": + i = 0; + if(len >= 2 && data[0] == 0xFE) if(data[1] == 0xFF) i = 2; j = 2; - for(i = 0; i < len; i+=j) { + for(; i < len; i+=j) { out[k++] = String.fromCharCode((data[i]<<8) + data[i+1]); } break; case "utf32le": + i = 0; + if(len >= 4 && data[0] == 0xFF) if(data[1] == 0xFE && data[2] == 0 && data[3] == 0) i = 4; j = 4; - for(i = 0; i < len; i+=j) { + for(; i < len; i+=j) { w = (data[i+3]<<24) + (data[i+2]<<16) + (data[i+1]<<8) + (data[i]); if(w > 0xFFFF) { w -= 0x10000; @@ -447,8 +457,10 @@ } break; case "utf32be": + i = 0; + if(len >= 4 && data[3] == 0xFF) if(data[2] == 0xFE && data[1] == 0 && data[0] == 0) i = 4; j = 4; - for(i = 0; i < len; i+=j) { + for(; i < len; i+=j) { w = (data[i]<<24) + (data[i+1]<<16) + (data[i+2]<<8) + (data[i+3]); if(w > 0xFFFF) { w -= 0x10000; @@ -459,7 +471,12 @@ } break; case "utf7": - for(i = 0; i < len; i+=j) { + i = 0; + if(len >= 4 && data[0] == 0x2B && data[1] == 0x2F && data[2] == 0x76) { + if(len >= 5 && data[3] == 0x38 && data[4] == 0x2D) i = 5; + else if(data[3] == 0x38 || data[3] == 0x39 || data[3] == 0x2B || data[3] == 0x2F) i = 4; + } + for(; i < len; i+=j) { if(data[i] !== 0x2b) { j=1; out[k++] = String.fromCharCode(data[i]); continue; } j=1; if(data[i+1] === 0x2d) { j = 2; out[k++] = "+"; continue; } diff --git a/ctest/tests.js b/ctest/tests.js index 49e62ba..33bfa9e 100644 --- a/ctest/tests.js +++ b/ctest/tests.js @@ -47,8 +47,8 @@ describe('consistency', function() { cptable.utils.cache.encache(); }); }; }; - Object.keys(cptable).filter(function(w) { return w != "utils"; }).forEach(chk(cptable, true)); - Object.keys(cptable).filter(function(w) { return w != "utils"; }).forEach(chk(cptable, false)); + Object.keys(cptable).filter(function(w) { return w == +w; }).forEach(chk(cptable, true)); + Object.keys(cptable).filter(function(w) { return w == +w; }).forEach(chk(cptable, false)); }); describe('entry conditions', function() { var chken = function(cp, i) { diff --git a/dist/cpexcel.full.js b/dist/cpexcel.full.js index 312a90e..4cbd91a 100644 --- a/dist/cpexcel.full.js +++ b/dist/cpexcel.full.js @@ -1,6 +1,6 @@ /* cpexcel.js (C) 2013-2014 SheetJS -- http://sheetjs.com */ /*jshint -W100 */ -var cptable = {}; +var cptable = {version:"1.3.4"}; cptable[874] = (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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[932] = (function(){ var d = [], e = {}, D = [], j; D[0] = "\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{|}~���������������������������������。「」、・ヲァィゥェォャュョッーアイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワン゙゚��������������������������������".split(""); @@ -789,6 +789,8 @@ cptable[1253] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006 cptable[1254] = (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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[1255] = (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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[1256] = (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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); +cptable[1257] = (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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); +cptable[1258] = (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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[10000] = (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{|}~ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[10006] = (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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[10007] = (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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); @@ -987,7 +989,9 @@ if (typeof module !== 'undefined' && module.exports) module.exports = cptable; var len = data.length, w = 0, ww = 0; if(4 * len > mdl) { mdl = 4 * len; mdb = new Buffer(mdl); } mdb.length = 0; - for(var i = 0, j = 1, k = 0, D = 0; i < len; i+=j) { + var i = 0; + if(len >= 3 && data[0] == 0xEF) if(data[1] == 0xBB && data[2] == 0xBF) i = 3; + for(var j = 1, k = 0, D = 0; i < len; i+=j) { j = 1; D = data[i]; if(D < 128) w = D; else if(D < 224) { w=(D&31)*64+(data[i+1]&63); j=2; } @@ -1202,7 +1206,9 @@ if (typeof module !== 'undefined' && module.exports) module.exports = cptable; } else if((M=magic[cp])) switch(M) { case "utf8": - for(i = 0; i < len; i+=j) { + i = 0; + if(len >= 3 && data[0] == 0xEF) if(data[1] == 0xBB && data[2] == 0xBF) i = 3; + for(; i < len; i+=j) { j = 1; if(data[i] < 128) w = data[i]; else if(data[i] < 224) { w=(data[i]&31)*64+(data[i+1]&63); j=2; } @@ -1220,21 +1226,27 @@ if (typeof module !== 'undefined' && module.exports) module.exports = cptable; for(i = 0; i < len; i++) out[i] = String.fromCharCode(data[i]); k = len; break; case "utf16le": + i = 0; + if(len >= 2 && data[0] == 0xFF) if(data[1] == 0xFE) i = 2; if(typeof Buffer !== 'undefined' && Buffer.isBuffer(data)) return data.toString(M); j = 2; - for(i = 0; i < len; i+=j) { + for(; i < len; i+=j) { out[k++] = String.fromCharCode((data[i+1]<<8) + data[i]); } break; case "utf16be": + i = 0; + if(len >= 2 && data[0] == 0xFE) if(data[1] == 0xFF) i = 2; j = 2; - for(i = 0; i < len; i+=j) { + for(; i < len; i+=j) { out[k++] = String.fromCharCode((data[i]<<8) + data[i+1]); } break; case "utf32le": + i = 0; + if(len >= 4 && data[0] == 0xFF) if(data[1] == 0xFE && data[2] == 0 && data[3] == 0) i = 4; j = 4; - for(i = 0; i < len; i+=j) { + for(; i < len; i+=j) { w = (data[i+3]<<24) + (data[i+2]<<16) + (data[i+1]<<8) + (data[i]); if(w > 0xFFFF) { w -= 0x10000; @@ -1245,8 +1257,10 @@ if (typeof module !== 'undefined' && module.exports) module.exports = cptable; } break; case "utf32be": + i = 0; + if(len >= 4 && data[3] == 0xFF) if(data[2] == 0xFE && data[1] == 0 && data[0] == 0) i = 4; j = 4; - for(i = 0; i < len; i+=j) { + for(; i < len; i+=j) { w = (data[i]<<24) + (data[i+1]<<16) + (data[i+2]<<8) + (data[i+3]); if(w > 0xFFFF) { w -= 0x10000; @@ -1257,7 +1271,12 @@ if (typeof module !== 'undefined' && module.exports) module.exports = cptable; } break; case "utf7": - for(i = 0; i < len; i+=j) { + i = 0; + if(len >= 4 && data[0] == 0x2B && data[1] == 0x2F && data[2] == 0x76) { + if(len >= 5 && data[3] == 0x38 && data[4] == 0x2D) i = 5; + else if(data[3] == 0x38 || data[3] == 0x39 || data[3] == 0x2B || data[3] == 0x2F) i = 4; + } + for(; i < len; i+=j) { if(data[i] !== 0x2b) { j=1; out[k++] = String.fromCharCode(data[i]); continue; } j=1; if(data[i+1] === 0x2d) { j = 2; out[k++] = "+"; continue; } diff --git a/dist/cpexcel.js b/dist/cpexcel.js index 7ad4251..b3a000c 100644 --- a/dist/cpexcel.js +++ b/dist/cpexcel.js @@ -1,6 +1,6 @@ /* cpexcel.js (C) 2013-2014 SheetJS -- http://sheetjs.com */ /*jshint -W100 */ -var cptable = {}; +var cptable = {version:"1.3.4"}; cptable[874] = (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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[932] = (function(){ var d = [], e = {}, D = [], j; D[0] = "\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{|}~���������������������������������。「」、・ヲァィゥェォャュョッーアイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワン゙゚��������������������������������".split(""); @@ -789,6 +789,8 @@ cptable[1253] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006 cptable[1254] = (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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[1255] = (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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[1256] = (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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); +cptable[1257] = (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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); +cptable[1258] = (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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[10000] = (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{|}~ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[10006] = (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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[10007] = (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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); diff --git a/dist/cptable.full.js b/dist/cptable.full.js index bc4543d..497cb00 100644 --- a/dist/cptable.full.js +++ b/dist/cptable.full.js @@ -1,6 +1,6 @@ /* cptable.js (C) 2013-2014 SheetJS -- http://sheetjs.com */ /*jshint -W100 */ -var cptable = {}; +var cptable = {version:"1.3.4"}; 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[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[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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); @@ -3586,6 +3586,7 @@ D[253] = "����������������������� for(j = 0; j != D[253].length; ++j) if(D[253][j].charCodeAt(0) !== 0xFFFD) { e[D[253][j]] = 64768 + j; d[64768 + j] = D[253][j];} return {"enc": e, "dec": d }; })(); cptable[21025] = (function(){ var d = "ŸŸ\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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); +cptable[21027] = (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\u0000 \u0000。「」、・ヲァィ¢.<(+|&ゥェォャュョッーア!$*);¬-/イウエオカキケ\u0000,%_>?コサシスセソタチツ`:#@'\"\u0000abcdefghiテトナニŽネ\u0000jklmnopqrノハヒフヘホ¯~stuvwxyzマミム[メモ^£¥ヤユヨラリルレロワン]゙゚{ABCDEFG\u0000\u0000}JKLMNOP\u0000\\\u0000STUVWX\u0000\u000001234567", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[21866] = (function(){ var d = "ЪЪ\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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[29001] = (function(){ var d = "ΈΉΊΌΎ°◘○◙♂♀♪♬☼▶◀↕‼¶§£Ώ↑↓→←Ë↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùΑÖÜøαØάΒáíóúñÑβΓγΔδΕεέΖζΗηή│ªÁÂÀΘθ║╗╝ΙΪ┐└º¡¿─΄ãÃ╚╔ιίϊ═ΐΚκΛÊλΜμÍΝν┘┌ΞξΟοόÓßÔΠõÕπΡρÚΣςσΤτΥΫυύϋΰΦφΧχΨ·ψΩωώ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[38598] = (function(){ var d = "\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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); @@ -6527,7 +6528,9 @@ if (typeof module !== 'undefined' && module.exports) module.exports = cptable; var len = data.length, w = 0, ww = 0; if(4 * len > mdl) { mdl = 4 * len; mdb = new Buffer(mdl); } mdb.length = 0; - for(var i = 0, j = 1, k = 0, D = 0; i < len; i+=j) { + var i = 0; + if(len >= 3 && data[0] == 0xEF) if(data[1] == 0xBB && data[2] == 0xBF) i = 3; + for(var j = 1, k = 0, D = 0; i < len; i+=j) { j = 1; D = data[i]; if(D < 128) w = D; else if(D < 224) { w=(D&31)*64+(data[i+1]&63); j=2; } @@ -6742,7 +6745,9 @@ if (typeof module !== 'undefined' && module.exports) module.exports = cptable; } else if((M=magic[cp])) switch(M) { case "utf8": - for(i = 0; i < len; i+=j) { + i = 0; + if(len >= 3 && data[0] == 0xEF) if(data[1] == 0xBB && data[2] == 0xBF) i = 3; + for(; i < len; i+=j) { j = 1; if(data[i] < 128) w = data[i]; else if(data[i] < 224) { w=(data[i]&31)*64+(data[i+1]&63); j=2; } @@ -6760,21 +6765,27 @@ if (typeof module !== 'undefined' && module.exports) module.exports = cptable; for(i = 0; i < len; i++) out[i] = String.fromCharCode(data[i]); k = len; break; case "utf16le": + i = 0; + if(len >= 2 && data[0] == 0xFF) if(data[1] == 0xFE) i = 2; if(typeof Buffer !== 'undefined' && Buffer.isBuffer(data)) return data.toString(M); j = 2; - for(i = 0; i < len; i+=j) { + for(; i < len; i+=j) { out[k++] = String.fromCharCode((data[i+1]<<8) + data[i]); } break; case "utf16be": + i = 0; + if(len >= 2 && data[0] == 0xFE) if(data[1] == 0xFF) i = 2; j = 2; - for(i = 0; i < len; i+=j) { + for(; i < len; i+=j) { out[k++] = String.fromCharCode((data[i]<<8) + data[i+1]); } break; case "utf32le": + i = 0; + if(len >= 4 && data[0] == 0xFF) if(data[1] == 0xFE && data[2] == 0 && data[3] == 0) i = 4; j = 4; - for(i = 0; i < len; i+=j) { + for(; i < len; i+=j) { w = (data[i+3]<<24) + (data[i+2]<<16) + (data[i+1]<<8) + (data[i]); if(w > 0xFFFF) { w -= 0x10000; @@ -6785,8 +6796,10 @@ if (typeof module !== 'undefined' && module.exports) module.exports = cptable; } break; case "utf32be": + i = 0; + if(len >= 4 && data[3] == 0xFF) if(data[2] == 0xFE && data[1] == 0 && data[0] == 0) i = 4; j = 4; - for(i = 0; i < len; i+=j) { + for(; i < len; i+=j) { w = (data[i]<<24) + (data[i+1]<<16) + (data[i+2]<<8) + (data[i+3]); if(w > 0xFFFF) { w -= 0x10000; @@ -6797,7 +6810,12 @@ if (typeof module !== 'undefined' && module.exports) module.exports = cptable; } break; case "utf7": - for(i = 0; i < len; i+=j) { + i = 0; + if(len >= 4 && data[0] == 0x2B && data[1] == 0x2F && data[2] == 0x76) { + if(len >= 5 && data[3] == 0x38 && data[4] == 0x2D) i = 5; + else if(data[3] == 0x38 || data[3] == 0x39 || data[3] == 0x2B || data[3] == 0x2F) i = 4; + } + for(; i < len; i+=j) { if(data[i] !== 0x2b) { j=1; out[k++] = String.fromCharCode(data[i]); continue; } j=1; if(data[i+1] === 0x2d) { j = 2; out[k++] = "+"; continue; } diff --git a/dist/cptable.js b/dist/cptable.js index 3f83c77..8caa6cf 100644 --- a/dist/cptable.js +++ b/dist/cptable.js @@ -1,6 +1,6 @@ /* cptable.js (C) 2013-2014 SheetJS -- http://sheetjs.com */ /*jshint -W100 */ -var cptable = {}; +var cptable = {version:"1.3.4"}; 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[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[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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); @@ -3586,6 +3586,7 @@ D[253] = "����������������������� for(j = 0; j != D[253].length; ++j) if(D[253][j].charCodeAt(0) !== 0xFFFD) { e[D[253][j]] = 64768 + j; d[64768 + j] = D[253][j];} return {"enc": e, "dec": d }; })(); cptable[21025] = (function(){ var d = "ŸŸ\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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); +cptable[21027] = (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\u0000 \u0000。「」、・ヲァィ¢.<(+|&ゥェォャュョッーア!$*);¬-/イウエオカキケ\u0000,%_>?コサシスセソタチツ`:#@'\"\u0000abcdefghiテトナニŽネ\u0000jklmnopqrノハヒフヘホ¯~stuvwxyzマミム[メモ^£¥ヤユヨラリルレロワン]゙゚{ABCDEFG\u0000\u0000}JKLMNOP\u0000\\\u0000STUVWX\u0000\u000001234567", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[21866] = (function(){ var d = "ЪЪ\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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[29001] = (function(){ var d = "ΈΉΊΌΎ°◘○◙♂♀♪♬☼▶◀↕‼¶§£Ώ↑↓→←Ë↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùΑÖÜøαØάΒáíóúñÑβΓγΔδΕεέΖζΗηή│ªÁÂÀΘθ║╗╝ΙΪ┐└º¡¿─΄ãÃ╚╔ιίϊ═ΐΚκΛÊλΜμÍΝν┘┌ΞξΟοόÓßÔΠõÕπΡρÚΣςσΤτΥΫυύϋΰΦφΧχΨ·ψΩωώ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[38598] = (function(){ var d = "\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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); diff --git a/dist/cputils.js b/dist/cputils.js index 435d8b4..eb9bef2 100644 --- a/dist/cputils.js +++ b/dist/cputils.js @@ -189,7 +189,9 @@ var len = data.length, w = 0, ww = 0; if(4 * len > mdl) { mdl = 4 * len; mdb = new Buffer(mdl); } mdb.length = 0; - for(var i = 0, j = 1, k = 0, D = 0; i < len; i+=j) { + var i = 0; + if(len >= 3 && data[0] == 0xEF) if(data[1] == 0xBB && data[2] == 0xBF) i = 3; + for(var j = 1, k = 0, D = 0; i < len; i+=j) { j = 1; D = data[i]; if(D < 128) w = D; else if(D < 224) { w=(D&31)*64+(data[i+1]&63); j=2; } @@ -404,7 +406,9 @@ } else if((M=magic[cp])) switch(M) { case "utf8": - for(i = 0; i < len; i+=j) { + i = 0; + if(len >= 3 && data[0] == 0xEF) if(data[1] == 0xBB && data[2] == 0xBF) i = 3; + for(; i < len; i+=j) { j = 1; if(data[i] < 128) w = data[i]; else if(data[i] < 224) { w=(data[i]&31)*64+(data[i+1]&63); j=2; } @@ -422,21 +426,27 @@ for(i = 0; i < len; i++) out[i] = String.fromCharCode(data[i]); k = len; break; case "utf16le": + i = 0; + if(len >= 2 && data[0] == 0xFF) if(data[1] == 0xFE) i = 2; if(typeof Buffer !== 'undefined' && Buffer.isBuffer(data)) return data.toString(M); j = 2; - for(i = 0; i < len; i+=j) { + for(; i < len; i+=j) { out[k++] = String.fromCharCode((data[i+1]<<8) + data[i]); } break; case "utf16be": + i = 0; + if(len >= 2 && data[0] == 0xFE) if(data[1] == 0xFF) i = 2; j = 2; - for(i = 0; i < len; i+=j) { + for(; i < len; i+=j) { out[k++] = String.fromCharCode((data[i]<<8) + data[i+1]); } break; case "utf32le": + i = 0; + if(len >= 4 && data[0] == 0xFF) if(data[1] == 0xFE && data[2] == 0 && data[3] == 0) i = 4; j = 4; - for(i = 0; i < len; i+=j) { + for(; i < len; i+=j) { w = (data[i+3]<<24) + (data[i+2]<<16) + (data[i+1]<<8) + (data[i]); if(w > 0xFFFF) { w -= 0x10000; @@ -447,8 +457,10 @@ } break; case "utf32be": + i = 0; + if(len >= 4 && data[3] == 0xFF) if(data[2] == 0xFE && data[1] == 0 && data[0] == 0) i = 4; j = 4; - for(i = 0; i < len; i+=j) { + for(; i < len; i+=j) { w = (data[i]<<24) + (data[i+1]<<16) + (data[i+2]<<8) + (data[i+3]); if(w > 0xFFFF) { w -= 0x10000; @@ -459,7 +471,12 @@ } break; case "utf7": - for(i = 0; i < len; i+=j) { + i = 0; + if(len >= 4 && data[0] == 0x2B && data[1] == 0x2F && data[2] == 0x76) { + if(len >= 5 && data[3] == 0x38 && data[4] == 0x2D) i = 5; + else if(data[3] == 0x38 || data[3] == 0x39 || data[3] == 0x2B || data[3] == 0x2F) i = 4; + } + for(; i < len; i+=j) { if(data[i] !== 0x2b) { j=1; out[k++] = String.fromCharCode(data[i]); continue; } j=1; if(data[i+1] === 0x2d) { j = 2; out[k++] = "+"; continue; } diff --git a/dist/sbcs.full.js b/dist/sbcs.full.js index 8bf1768..37b2741 100644 --- a/dist/sbcs.full.js +++ b/dist/sbcs.full.js @@ -1,6 +1,6 @@ /* sbcs.js (C) 2013-2014 SheetJS -- http://sheetjs.com */ /*jshint -W100 */ -var cptable = {}; +var cptable = {version:"1.3.4"}; 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[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[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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); @@ -96,6 +96,7 @@ cptable[20880] = (function(){ var d = "ŸŸ\u0002\u0003œ\t†—Ž\u000b\f\r\u cptable[20905] = (function(){ var d = "ŸŸ\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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[20924] = (function(){ var d = "ŸŸ\u0002\u0003œ\t†—Ž\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\n\b‡\u0018\u0019’\u001c\u001d\u001e\u001f€‚ƒ„…\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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[21025] = (function(){ var d = "ŸŸ\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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); +cptable[21027] = (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\u0000 \u0000。「」、・ヲァィ¢.<(+|&ゥェォャュョッーア!$*);¬-/イウエオカキケ\u0000,%_>?コサシスセソタチツ`:#@'\"\u0000abcdefghiテトナニŽネ\u0000jklmnopqrノハヒフヘホ¯~stuvwxyzマミム[メモ^£¥ヤユヨラリルレロワン]゙゚{ABCDEFG\u0000\u0000}JKLMNOP\u0000\\\u0000STUVWX\u0000\u000001234567", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[21866] = (function(){ var d = "ЪЪ\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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[29001] = (function(){ var d = "ΈΉΊΌΎ°◘○◙♂♀♪♬☼▶◀↕‼¶§£Ώ↑↓→←Ë↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùΑÖÜøαØάΒáíóúñÑβΓγΔδΕεέΖζΗηή│ªÁÂÀΘθ║╗╝ΙΪ┐└º¡¿─΄ãÃ╚╔ιίϊ═ΐΚκΛÊλΜμÍΝν┘┌ΞξΟοόÓßÔΠõÕπΡρÚΣςσΤτΥΫυύϋΰΦφΧχΨ·ψΩωώ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[38598] = (function(){ var d = "\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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); @@ -291,7 +292,9 @@ if (typeof module !== 'undefined' && module.exports) module.exports = cptable; var len = data.length, w = 0, ww = 0; if(4 * len > mdl) { mdl = 4 * len; mdb = new Buffer(mdl); } mdb.length = 0; - for(var i = 0, j = 1, k = 0, D = 0; i < len; i+=j) { + var i = 0; + if(len >= 3 && data[0] == 0xEF) if(data[1] == 0xBB && data[2] == 0xBF) i = 3; + for(var j = 1, k = 0, D = 0; i < len; i+=j) { j = 1; D = data[i]; if(D < 128) w = D; else if(D < 224) { w=(D&31)*64+(data[i+1]&63); j=2; } @@ -506,7 +509,9 @@ if (typeof module !== 'undefined' && module.exports) module.exports = cptable; } else if((M=magic[cp])) switch(M) { case "utf8": - for(i = 0; i < len; i+=j) { + i = 0; + if(len >= 3 && data[0] == 0xEF) if(data[1] == 0xBB && data[2] == 0xBF) i = 3; + for(; i < len; i+=j) { j = 1; if(data[i] < 128) w = data[i]; else if(data[i] < 224) { w=(data[i]&31)*64+(data[i+1]&63); j=2; } @@ -524,21 +529,27 @@ if (typeof module !== 'undefined' && module.exports) module.exports = cptable; for(i = 0; i < len; i++) out[i] = String.fromCharCode(data[i]); k = len; break; case "utf16le": + i = 0; + if(len >= 2 && data[0] == 0xFF) if(data[1] == 0xFE) i = 2; if(typeof Buffer !== 'undefined' && Buffer.isBuffer(data)) return data.toString(M); j = 2; - for(i = 0; i < len; i+=j) { + for(; i < len; i+=j) { out[k++] = String.fromCharCode((data[i+1]<<8) + data[i]); } break; case "utf16be": + i = 0; + if(len >= 2 && data[0] == 0xFE) if(data[1] == 0xFF) i = 2; j = 2; - for(i = 0; i < len; i+=j) { + for(; i < len; i+=j) { out[k++] = String.fromCharCode((data[i]<<8) + data[i+1]); } break; case "utf32le": + i = 0; + if(len >= 4 && data[0] == 0xFF) if(data[1] == 0xFE && data[2] == 0 && data[3] == 0) i = 4; j = 4; - for(i = 0; i < len; i+=j) { + for(; i < len; i+=j) { w = (data[i+3]<<24) + (data[i+2]<<16) + (data[i+1]<<8) + (data[i]); if(w > 0xFFFF) { w -= 0x10000; @@ -549,8 +560,10 @@ if (typeof module !== 'undefined' && module.exports) module.exports = cptable; } break; case "utf32be": + i = 0; + if(len >= 4 && data[3] == 0xFF) if(data[2] == 0xFE && data[1] == 0 && data[0] == 0) i = 4; j = 4; - for(i = 0; i < len; i+=j) { + for(; i < len; i+=j) { w = (data[i]<<24) + (data[i+1]<<16) + (data[i+2]<<8) + (data[i+3]); if(w > 0xFFFF) { w -= 0x10000; @@ -561,7 +574,12 @@ if (typeof module !== 'undefined' && module.exports) module.exports = cptable; } break; case "utf7": - for(i = 0; i < len; i+=j) { + i = 0; + if(len >= 4 && data[0] == 0x2B && data[1] == 0x2F && data[2] == 0x76) { + if(len >= 5 && data[3] == 0x38 && data[4] == 0x2D) i = 5; + else if(data[3] == 0x38 || data[3] == 0x39 || data[3] == 0x2B || data[3] == 0x2F) i = 4; + } + for(; i < len; i+=j) { if(data[i] !== 0x2b) { j=1; out[k++] = String.fromCharCode(data[i]); continue; } j=1; if(data[i+1] === 0x2d) { j = 2; out[k++] = "+"; continue; } diff --git a/dist/sbcs.js b/dist/sbcs.js index 82d8e9a..8b69592 100644 --- a/dist/sbcs.js +++ b/dist/sbcs.js @@ -1,6 +1,6 @@ /* sbcs.js (C) 2013-2014 SheetJS -- http://sheetjs.com */ /*jshint -W100 */ -var cptable = {}; +var cptable = {version:"1.3.4"}; 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[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[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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); @@ -96,6 +96,7 @@ cptable[20880] = (function(){ var d = "ŸŸ\u0002\u0003œ\t†—Ž\u000b\f\r\u cptable[20905] = (function(){ var d = "ŸŸ\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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[20924] = (function(){ var d = "ŸŸ\u0002\u0003œ\t†—Ž\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\n\b‡\u0018\u0019’\u001c\u001d\u001e\u001f€‚ƒ„…\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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[21025] = (function(){ var d = "ŸŸ\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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); +cptable[21027] = (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\u0000 \u0000。「」、・ヲァィ¢.<(+|&ゥェォャュョッーア!$*);¬-/イウエオカキケ\u0000,%_>?コサシスセソタチツ`:#@'\"\u0000abcdefghiテトナニŽネ\u0000jklmnopqrノハヒフヘホ¯~stuvwxyzマミム[メモ^£¥ヤユヨラリルレロワン]゙゚{ABCDEFG\u0000\u0000}JKLMNOP\u0000\\\u0000STUVWX\u0000\u000001234567", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[21866] = (function(){ var d = "ЪЪ\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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[29001] = (function(){ var d = "ΈΉΊΌΎ°◘○◙♂♀♪♬☼▶◀↕‼¶§£Ώ↑↓→←Ë↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùΑÖÜøαØάΒáíóúñÑβΓγΔδΕεέΖζΗηή│ªÁÂÀΘθ║╗╝ΙΪ┐└º¡¿─΄ãÃ╚╔ιίϊ═ΐΚκΛÊλΜμÍΝν┘┌ΞξΟοόÓßÔΠõÕπΡρÚΣςσΤτΥΫυύϋΰΦφΧχΨ·ψΩωώ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[38598] = (function(){ var d = "\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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); diff --git a/excel.csv b/excel.csv index 14dc253..e2f987c 100644 --- a/excel.csv +++ b/excel.csv @@ -10,6 +10,8 @@ 1254,http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1254.TXT,1 1255,http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1255.TXT,1 1256,http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1256.TXT,1 +1257,http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1257.TXT,1 +1258,http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1258.TXT,1 10000,http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/MAC/ROMAN.TXT,1 10006,http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/MAC/GREEK.TXT,1 10007,http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/MAC/CYRILLIC.TXT,1 diff --git a/nls/nls2tbl.njs b/nls/nls2tbl.njs new file mode 100644 index 0000000..2604132 --- /dev/null +++ b/nls/nls2tbl.njs @@ -0,0 +1,21 @@ +#!/usr/bin/env node +/* js-codepage (C) 2014 SheetJS -- http://sheetjs.com */ +/* vim: set ts=2 ft=javascript: */ +/* nls2tbl: read windows NLS (c:\windows\system32\C_.NLS files, make TBL */ +var fs = require('fs'); +var C = fs.readFileSync(process.argv[2]); + +function hex(c, l) { + var o = c.toString(16).toUpperCase(); + var p = ""; + if(o.length < l) p = new Array(l+1-o.length).join("0"); + return "0x" + p + o +} + +var i = 28; +var seen = []; +for(var k=0; k!=256; ++k) { + var j = C.readUInt16LE(i+2*k); + console.log(hex(k,2) + "\t" + hex(j, 4)); + seen[j] = true; +} diff --git a/package.json b/package.json index ea9f134..287d5ff 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codepage", - "version": "1.3.3", + "version": "1.3.4", "author": "SheetJS", "description": "pure-JS library to handle codepages", "keywords": [ "codepage", "iconv", "convert", "strings" ], diff --git a/pages.csv b/pages.csv index adb2827..f848bb0 100644 --- a/pages.csv +++ b/pages.csv @@ -112,6 +112,7 @@ 20936,,2 20949,,2 21025,,1 +21027,,1 21866,,1 29001,,1 38598,,1 diff --git a/sbcs.js b/sbcs.js index 82d8e9a..8b69592 100644 --- a/sbcs.js +++ b/sbcs.js @@ -1,6 +1,6 @@ /* sbcs.js (C) 2013-2014 SheetJS -- http://sheetjs.com */ /*jshint -W100 */ -var cptable = {}; +var cptable = {version:"1.3.4"}; 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[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[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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); @@ -96,6 +96,7 @@ cptable[20880] = (function(){ var d = "ŸŸ\u0002\u0003œ\t†—Ž\u000b\f\r\u cptable[20905] = (function(){ var d = "ŸŸ\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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[20924] = (function(){ var d = "ŸŸ\u0002\u0003œ\t†—Ž\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\n\b‡\u0018\u0019’\u001c\u001d\u001e\u001f€‚ƒ„…\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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[21025] = (function(){ var d = "ŸŸ\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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); +cptable[21027] = (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\u0000 \u0000。「」、・ヲァィ¢.<(+|&ゥェォャュョッーア!$*);¬-/イウエオカキケ\u0000,%_>?コサシスセソタチツ`:#@'\"\u0000abcdefghiテトナニŽネ\u0000jklmnopqrノハヒフヘホ¯~stuvwxyzマミム[メモ^£¥ヤユヨラリルレロワン]゙゚{ABCDEFG\u0000\u0000}JKLMNOP\u0000\\\u0000STUVWX\u0000\u000001234567", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[21866] = (function(){ var d = "ЪЪ\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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[29001] = (function(){ var d = "ΈΉΊΌΎ°◘○◙♂♀♪♬☼▶◀↕‼¶§£Ώ↑↓→←Ë↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùΑÖÜøαØάΒáíóúñÑβΓγΔδΕεέΖζΗηή│ªÁÂÀΘθ║╗╝ΙΪ┐└º¡¿─΄ãÃ╚╔ιίϊ═ΐΚκΛÊλΜμÍΝν┘┌ΞξΟοόÓßÔΠõÕπΡρÚΣςσΤτΥΫυύϋΰΦφΧχΨ·ψΩωώ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); cptable[38598] = (function(){ var d = "\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[i]] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })(); diff --git a/test.js b/test.js index 3cac6a1..9073cd8 100644 --- a/test.js +++ b/test.js @@ -69,8 +69,8 @@ describe('consistency', function() { cptable.utils.cache.encache(); }); }; }; - Object.keys(cptable).filter(function(w) { return w != "utils"; }).forEach(chk(cptable, true)); - Object.keys(cptable).filter(function(w) { return w != "utils"; }).forEach(chk(cptable, false)); + Object.keys(cptable).filter(function(w) { return w == +w; }).forEach(chk(cptable, true)); + Object.keys(cptable).filter(function(w) { return w == +w; }).forEach(chk(cptable, false)); }); describe('entry conditions', function() { it('should fail to load utils if cptable unavailable', function() {