forked from sheetjs/sheetjs
Fix issue with dbf parsing
This commit is contained in:
parent
c26525d52c
commit
c615f85034
@ -55,6 +55,7 @@ var dbf_reverse_map = evert({
|
||||
/*::[*/0xCA/*::]*/: 1254, /*::[*/0xCB/*::]*/: 1253,
|
||||
/*::[*/0x00/*::]*/: 20127
|
||||
});
|
||||
var DBF_SUPPORTED_VERSIONS = [0x02, 0x03, 0x30, 0x31, 0x83, 0x8B, 0x8C, 0xF5];
|
||||
/* TODO: find an actual specification */
|
||||
function dbf_to_aoa(buf, opts)/*:AOA*/ {
|
||||
var out/*:AOA*/ = [];
|
||||
@ -308,6 +309,7 @@ function sheet_to_dbf(ws/*:Worksheet*/, opts/*:WriteOpts*/) {
|
||||
return ba.end();
|
||||
}
|
||||
return {
|
||||
versions: DBF_SUPPORTED_VERSIONS,
|
||||
to_workbook: dbf_to_workbook,
|
||||
to_sheet: dbf_to_sheet,
|
||||
from_sheet: sheet_to_dbf
|
||||
@ -820,7 +822,7 @@ var PRN = (function() {
|
||||
}
|
||||
// If line ends in \r OR \n
|
||||
else if(str.charCodeAt(5) == 13 || str.charCodeAt(5) == 10 ) {
|
||||
//
|
||||
//
|
||||
sep = str.charAt(4); str = str.slice(6);
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ function readSync(data/*:RawData*/, opts/*:?ParseOpts*/)/*:Workbook*/ {
|
||||
case 0x7B: if(n[1] === 0x5C && n[2] === 0x72 && n[3] === 0x74) return RTF.to_workbook(d, o); break;
|
||||
case 0x0A: case 0x0D: case 0x20: return read_plaintext_raw(d, o);
|
||||
}
|
||||
if(n[2] <= 12 && n[3] <= 31) return DBF.to_workbook(d, o);
|
||||
if(DBF.versions.indexOf(n[0]) > -1 && n[2] <= 12 && n[3] <= 31) return DBF.to_workbook(d, o);
|
||||
return read_prn(data, d, o, str);
|
||||
}
|
||||
|
||||
|
@ -6914,6 +6914,7 @@ var dbf_reverse_map = evert({
|
||||
/*::[*/0xCA/*::]*/: 1254, /*::[*/0xCB/*::]*/: 1253,
|
||||
/*::[*/0x00/*::]*/: 20127
|
||||
});
|
||||
var DBF_SUPPORTED_VERSIONS = [0x02, 0x03, 0x30, 0x31, 0x83, 0x8B, 0x8C, 0xF5];
|
||||
/* TODO: find an actual specification */
|
||||
function dbf_to_aoa(buf, opts)/*:AOA*/ {
|
||||
var out/*:AOA*/ = [];
|
||||
@ -7167,6 +7168,7 @@ function sheet_to_dbf(ws/*:Worksheet*/, opts/*:WriteOpts*/) {
|
||||
return ba.end();
|
||||
}
|
||||
return {
|
||||
versions: DBF_SUPPORTED_VERSIONS,
|
||||
to_workbook: dbf_to_workbook,
|
||||
to_sheet: dbf_to_sheet,
|
||||
from_sheet: sheet_to_dbf
|
||||
@ -7679,7 +7681,7 @@ var PRN = (function() {
|
||||
}
|
||||
// If line ends in \r OR \n
|
||||
else if(str.charCodeAt(5) == 13 || str.charCodeAt(5) == 10 ) {
|
||||
//
|
||||
//
|
||||
sep = str.charAt(4); str = str.slice(6);
|
||||
}
|
||||
}
|
||||
@ -20950,7 +20952,7 @@ function readSync(data/*:RawData*/, opts/*:?ParseOpts*/)/*:Workbook*/ {
|
||||
case 0x7B: if(n[1] === 0x5C && n[2] === 0x72 && n[3] === 0x74) return RTF.to_workbook(d, o); break;
|
||||
case 0x0A: case 0x0D: case 0x20: return read_plaintext_raw(d, o);
|
||||
}
|
||||
if(n[2] <= 12 && n[3] <= 31) return DBF.to_workbook(d, o);
|
||||
if(DBF.versions.indexOf(n[0]) > -1 && n[2] <= 12 && n[3] <= 31) return DBF.to_workbook(d, o);
|
||||
return read_prn(data, d, o, str);
|
||||
}
|
||||
|
||||
|
6
xlsx.js
generated
6
xlsx.js
generated
@ -6817,6 +6817,7 @@ var dbf_reverse_map = evert({
|
||||
0xCA: 1254, 0xCB: 1253,
|
||||
0x00: 20127
|
||||
});
|
||||
var DBF_SUPPORTED_VERSIONS = [0x02, 0x03, 0x30, 0x31, 0x83, 0x8B, 0x8C, 0xF5];
|
||||
/* TODO: find an actual specification */
|
||||
function dbf_to_aoa(buf, opts) {
|
||||
var out = [];
|
||||
@ -7069,6 +7070,7 @@ function sheet_to_dbf(ws, opts) {
|
||||
return ba.end();
|
||||
}
|
||||
return {
|
||||
versions: DBF_SUPPORTED_VERSIONS,
|
||||
to_workbook: dbf_to_workbook,
|
||||
to_sheet: dbf_to_sheet,
|
||||
from_sheet: sheet_to_dbf
|
||||
@ -7581,7 +7583,7 @@ var PRN = (function() {
|
||||
}
|
||||
// If line ends in \r OR \n
|
||||
else if(str.charCodeAt(5) == 13 || str.charCodeAt(5) == 10 ) {
|
||||
//
|
||||
//
|
||||
sep = str.charAt(4); str = str.slice(6);
|
||||
}
|
||||
}
|
||||
@ -20826,7 +20828,7 @@ function readSync(data, opts) {
|
||||
case 0x7B: if(n[1] === 0x5C && n[2] === 0x72 && n[3] === 0x74) return RTF.to_workbook(d, o); break;
|
||||
case 0x0A: case 0x0D: case 0x20: return read_plaintext_raw(d, o);
|
||||
}
|
||||
if(n[2] <= 12 && n[3] <= 31) return DBF.to_workbook(d, o);
|
||||
if(DBF.versions.indexOf(n[0]) > -1 && n[2] <= 12 && n[3] <= 31) return DBF.to_workbook(d, o);
|
||||
return read_prn(data, d, o, str);
|
||||
}
|
||||
|
||||
|
@ -8135,7 +8135,7 @@ function readSync(data/*:RawData*/, opts/*:?ParseOpts*/)/*:Workbook*/ {
|
||||
case 0x7B: if(n[1] === 0x5C && n[2] === 0x72 && n[3] === 0x74) return RTF.to_workbook(d, o); break;
|
||||
case 0x0A: case 0x0D: case 0x20: return read_plaintext_raw(d, o);
|
||||
}
|
||||
if(n[2] <= 12 && n[3] <= 31) return DBF.to_workbook(d, o);
|
||||
if(DBF.versions.indexOf(n[0]) > -1 && n[2] <= 12 && n[3] <= 31) return DBF.to_workbook(d, o);
|
||||
return read_prn(data, d, o, str);
|
||||
}
|
||||
|
||||
|
@ -8038,7 +8038,7 @@ function readSync(data, opts) {
|
||||
case 0x7B: if(n[1] === 0x5C && n[2] === 0x72 && n[3] === 0x74) return RTF.to_workbook(d, o); break;
|
||||
case 0x0A: case 0x0D: case 0x20: return read_plaintext_raw(d, o);
|
||||
}
|
||||
if(n[2] <= 12 && n[3] <= 31) return DBF.to_workbook(d, o);
|
||||
if(DBF.versions.indexOf(n[0]) > -1 && n[2] <= 12 && n[3] <= 31) return DBF.to_workbook(d, o);
|
||||
return read_prn(data, d, o, str);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user