Browse Source

char replacement if non default quoteChar

pull/338/head
Simon Hilz 9 years ago
parent
commit
37c2100182
  1. 6
      papaparse.js

6
papaparse.js

@ -1128,7 +1128,7 @@
if (quoteSearch === inputLen-1) if (quoteSearch === inputLen-1)
{ {
// Closing quote at EOF // Closing quote at EOF
var value = input.substring(cursor, quoteSearch).replace(quoteCharRegex, '"'); var value = input.substring(cursor, quoteSearch).replace(quoteCharRegex, quoteChar);
return finish(value); return finish(value);
} }
@ -1142,7 +1142,7 @@
if (input[quoteSearch+1] === delim) if (input[quoteSearch+1] === delim)
{ {
// Closing quote followed by delimiter // Closing quote followed by delimiter
row.push(input.substring(cursor, quoteSearch).replace(quoteCharRegex, '"')); row.push(input.substring(cursor, quoteSearch).replace(quoteCharRegex, quoteChar));
cursor = quoteSearch + 1 + delimLen; cursor = quoteSearch + 1 + delimLen;
nextDelim = input.indexOf(delim, cursor); nextDelim = input.indexOf(delim, cursor);
nextNewline = input.indexOf(newline, cursor); nextNewline = input.indexOf(newline, cursor);
@ -1152,7 +1152,7 @@
if (input.substr(quoteSearch+1, newlineLen) === newline) if (input.substr(quoteSearch+1, newlineLen) === newline)
{ {
// Closing quote followed by newline // Closing quote followed by newline
row.push(input.substring(cursor, quoteSearch).replace(quoteCharRegex, '"')); row.push(input.substring(cursor, quoteSearch).replace(quoteCharRegex, quoteChar));
saveRow(quoteSearch + 1 + newlineLen); saveRow(quoteSearch + 1 + newlineLen);
nextDelim = input.indexOf(delim, cursor); // because we may have skipped the nextDelim in the quoted field nextDelim = input.indexOf(delim, cursor); // because we may have skipped the nextDelim in the quoted field

Loading…
Cancel
Save