forked from sheetjs/sheetjs
Merge pull request #2004 from garrettluu/master
Fix sep char recognition for CRLF newline files
This commit is contained in:
commit
c26525d52c
@ -813,7 +813,17 @@ var PRN = (function() {
|
||||
var ws/*:Worksheet*/ = o.dense ? ([]/*:any*/) : ({}/*:any*/);
|
||||
var range/*:Range*/ = ({s: {c:0, r:0}, e: {c:0, r:0}}/*:any*/);
|
||||
|
||||
if(str.slice(0,4) == "sep=" && str.charCodeAt(5) == 10) { sep = str.charAt(4); str = str.slice(6); }
|
||||
if(str.slice(0,4) == "sep=") {
|
||||
// If the line ends in \r\n
|
||||
if(str.charCodeAt(5) == 13 && str.charCodeAt(6) == 10 ) {
|
||||
sep = str.charAt(4); str = str.slice(7);
|
||||
}
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
else sep = guess_sep(str.slice(0,1024));
|
||||
var R = 0, C = 0, v = 0;
|
||||
var start = 0, end = 0, sepcc = sep.charCodeAt(0), instr = false, cc=0;
|
||||
|
12
xlsx.flow.js
12
xlsx.flow.js
@ -7672,7 +7672,17 @@ var PRN = (function() {
|
||||
var ws/*:Worksheet*/ = o.dense ? ([]/*:any*/) : ({}/*:any*/);
|
||||
var range/*:Range*/ = ({s: {c:0, r:0}, e: {c:0, r:0}}/*:any*/);
|
||||
|
||||
if(str.slice(0,4) == "sep=" && str.charCodeAt(5) == 10) { sep = str.charAt(4); str = str.slice(6); }
|
||||
if(str.slice(0,4) == "sep=") {
|
||||
// If the line ends in \r\n
|
||||
if(str.charCodeAt(5) == 13 && str.charCodeAt(6) == 10 ) {
|
||||
sep = str.charAt(4); str = str.slice(7);
|
||||
}
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
else sep = guess_sep(str.slice(0,1024));
|
||||
var R = 0, C = 0, v = 0;
|
||||
var start = 0, end = 0, sepcc = sep.charCodeAt(0), instr = false, cc=0;
|
||||
|
12
xlsx.js
generated
12
xlsx.js
generated
@ -7574,7 +7574,17 @@ var PRN = (function() {
|
||||
var ws = o.dense ? ([]) : ({});
|
||||
var range = ({s: {c:0, r:0}, e: {c:0, r:0}});
|
||||
|
||||
if(str.slice(0,4) == "sep=" && str.charCodeAt(5) == 10) { sep = str.charAt(4); str = str.slice(6); }
|
||||
if(str.slice(0,4) == "sep=") {
|
||||
// If the line ends in \r\n
|
||||
if(str.charCodeAt(5) == 13 && str.charCodeAt(6) == 10 ) {
|
||||
sep = str.charAt(4); str = str.slice(7);
|
||||
}
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
else sep = guess_sep(str.slice(0,1024));
|
||||
var R = 0, C = 0, v = 0;
|
||||
var start = 0, end = 0, sepcc = sep.charCodeAt(0), instr = false, cc=0;
|
||||
|
Loading…
Reference in New Issue
Block a user