version bump 0.1.5: proper parsing of strings

Note that CHAR actually appears to do different things in OSX and Windows ...

Need to build a separate codepage converter
This commit is contained in:
SheetJS 2013-03-21 19:54:30 -04:00
parent ce9e211760
commit f1aa13dfaf
2 changed files with 6 additions and 5 deletions

@ -1,6 +1,6 @@
{
"name": "xlsx",
"version": "0.1.4",
"version": "0.1.5",
"author": "Niggler",
"description": "(one day) a full-featured XLSX parser and writer. For now, primitive parser",
"keywords": [

@ -76,10 +76,11 @@ var encodings = {
'&': '&'
};
// TODO: CP remap (need to read file version to determine OS)
function unescapexml(text){
var s = text + '';
for(var y in encodings) s = s.replace(new RegExp(y,'g'), encodings[y]);
return s;
return s.replace(/_x([0-9a-fA-F]*)_/g,function(m,c) {return _chr(parseInt(c,16));});
}
function parsexmltag(tag) {
@ -103,8 +104,8 @@ function parseSheet(data) { //TODO: use a real xml parser
//s.rows = {};
//s.cells = {};
var q = ["v","f"];
if(!data.match(/<sheetData *\/>/))
data.match(/<sheetData>([^]*)<\/sheetData>/)[1].split("</row>").forEach(function(x) {
if(!data.match(/<sheetData *\/>/))
data.match(/<sheetData>([^]*)<\/sheetData>/m)[1].split("</row>").forEach(function(x) {
if(x === "") return;
var row = parsexmltag(x.match(/<row[^>]*>/)[0]); //s.rows[row.r]=row.spans;
if(refguess.s.r > row.r - 1) refguess.s.r = row.r - 1;
@ -125,7 +126,7 @@ function parseSheet(data) { //TODO: use a real xml parser
switch(p.t) {
case 'n': p.v = parseFloat(p.v); break;
case 's': p.v = strs[parseInt(p.v, 10)].t; break;
case 'str': break; // normal string
case 'str': p.v = utf8read(p.v); break; // normal string
case 'b':
switch(p.v) {
case '0': case 'FALSE': case "false": case false: p.v=false; break;