xsheetjs/bits/02_codepage.js
SheetJS b645f6ef98 version bump 0.6.2: bits reorganization
- updated SSF to 0.6.5
- XLSB 'dbcs' uses codepage
- README bugfix (h/t @noodles)
- new tests: rawjson and json baselines generated by hand
- single cell ranges are encoded as cells ("A1" instead of "A1:A1") (h/t @clxl)
- source code alignment with js-xls
2014-05-03 11:51:10 -07:00

15 lines
690 B
JavaScript

var current_codepage = 1252, current_cptable;
if(typeof module !== "undefined" && typeof require !== 'undefined') {
if(typeof cptable === 'undefined') cptable = require('codepage');
current_cptable = cptable[current_codepage];
}
function reset_cp() { set_cp(1252); }
function set_cp(cp) { current_codepage = cp; if(typeof cptable !== 'undefined') current_cptable = cptable[cp]; }
var _getchar = function(x) { return String.fromCharCode(x); };
if(typeof cptable !== 'undefined') _getchar = function(x) {
if (current_codepage === 1200) return String.fromCharCode(x);
if (current_cptable) return current_cptable.dec[x];
return cptable.utils.decode(current_codepage, [x%256,x>>8])[0];
};