Skip to content

Commit

Permalink
Fix misplaced quotes parsing (#702)
Browse files Browse the repository at this point in the history
Closes #699
  • Loading branch information
seachicken authored and pokoli committed Aug 26, 2019
1 parent 98e3102 commit 874161a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion papaparse.js
Original file line number Diff line number Diff line change
Expand Up @@ -1603,7 +1603,7 @@ License: MIT
if (nextDelim !== -1 && (nextDelim < nextNewline || nextNewline === -1))
{
// we check, if we have quotes, because delimiter char may be part of field enclosed in quotes
if (quoteSearch !== -1) {
if (quoteSearch > nextDelim) {
// we have quotes, so we try to find the next delimiter not enclosed in quotes and also next starting quote char
var nextDelimObj = getNextUnqotedDelimiter(nextDelim, quoteSearch, nextNewline);

Expand Down
8 changes: 8 additions & 0 deletions tests/test-cases.js
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,14 @@ var PARSE_TESTS = [
errors: []
}
},
{
description: "Misplaced quotes in data twice, not as opening quotes",
input: 'A,B",C\nD,E",F',
expected: {
data: [['A', 'B"', 'C'], ['D', 'E"', 'F']],
errors: []
}
},
{
description: "Mixed slash n and slash r should choose first as precident",
input: 'a,b,c\nd,e,f\rg,h,i\n',
Expand Down

0 comments on commit 874161a

Please sign in to comment.