Skip to content

[CSV-326] Escape Reader values with quote and escape#606

Merged
garydgregory merged 2 commits into
apache:masterfrom
OldTruckDriver:fix/csvprinter-reader-quote-escape
Jun 11, 2026
Merged

[CSV-326] Escape Reader values with quote and escape#606
garydgregory merged 2 commits into
apache:masterfrom
OldTruckDriver:fix/csvprinter-reader-quote-escape

Conversation

@OldTruckDriver

Copy link
Copy Markdown
Contributor

Fixes CSV-326.

CSVFormat#printWithQuotes(Reader, Appendable) escaped embedded quote characters but did not escape a configured escape character. When a Reader value contained an escape character immediately before a quote, CSVPrinter could emit CSV that the same format could not parse back.

This updates the Reader quoted printing path to escape both quote and escape characters, matching the CharSequence printing path's round-trip behavior.

Added a regression test for Reader printing with an escape character before a quote.

Tests:

  • mvn -q test

@garydgregory garydgregory merged commit 3af32d5 into apache:master Jun 11, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants