Skip to content

Keep line breaks quoted when serializing CSV fields - #145

Open
rupayon123 wants to merge 1 commit into
swiftcsv:masterfrom
rupayon123:contribution/quote-serialized-linebreaks-20260922
Open

rupayon123 wants to merge 1 commit into
swiftcsv:masterfrom
rupayon123:contribution/quote-serialized-linebreaks-20260922

Conversation

@rupayon123

Copy link
Copy Markdown

Serializing a parsed quoted field containing a line break currently removes its quotes when it contains no delimiter or quote character. Reading that output splits a data value into extra rows or changes the header. Quote any field containing the parser's recognized line breaks (LF, CR or CRLF), preserving the existing delimiter/quote escaping behavior.

Two new public-API round-trip tests fail with 42 assertions before the fix. All 44 Swift package tests pass after it. Coverage includes headers and data, named/enumerated views, all three line-break forms, comma/semicolon/tab/custom delimiters. Scoped SwiftLint reports only a pre-existing double-blank-line warning at Serializer.swift:22; the changed code has no new lint findings. git diff --check passes. This is macOS host validation, not an iOS/device or full Xcode platform matrix result.

Prepared with AI assistance; the serializer, parser's newline definition and public round-trip behavior were reviewed.

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.

1 participant