Skip to content

Commit

Permalink
Fixed CSV writer quoting
Browse files Browse the repository at this point in the history
  • Loading branch information
juerg committed Oct 31, 2023
1 parent ff9993f commit 278cbbb
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ private String escape(final String s) {
curr = pos + 1;
}
else {
sb.append(s.substring(pos));
sb.append(s.substring(curr));
break;
}
pos = s.indexOf(quote, curr);
Expand All @@ -146,7 +146,10 @@ private String quote(final String s) {
}

private boolean needsQuote(final String s) {
return s != null && (s.contains(" ") || s.contains(quote) || s.contains(separator));
return s != null && (s.contains(" ")
|| s.contains(quote)
|| s.contains(separator)
|| s.contains(newline));
}


Expand Down

0 comments on commit 278cbbb

Please sign in to comment.