diff --git a/bits/40_harb.js b/bits/40_harb.js index 8a619b6..ef00fb4 100644 --- a/bits/40_harb.js +++ b/bits/40_harb.js @@ -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; diff --git a/xlsx.flow.js b/xlsx.flow.js index f2d2232..c504734 100644 --- a/xlsx.flow.js +++ b/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; diff --git a/xlsx.js b/xlsx.js index 957ebec..b491dd3 100644 --- a/xlsx.js +++ b/xlsx.js @@ -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;