Skip to content

fix(csv-parse): trim Buffer fields without decoding - #554

Open
Sskift wants to merge 1 commit into
adaltas:masterfrom
Sskift:explore/rtrim-buffer-fields
Open

Sskift wants to merge 1 commit into
adaltas:masterfrom
Sskift:explore/rtrim-buffer-fields

Conversation

@Sskift

@Sskift Sskift commented Nov 2, 2026

Copy link
Copy Markdown

With encoding: null or false, fields are Buffers. Combining either setting with rtrim: true or trim: true calls field.trimRight() on an unquoted field and throws a TypeError, even for ordinary CSV data.

Trim complete trailing whitespace byte sequences using the parser's existing whitespace table when decoding is disabled. Preserve the returned Buffer, including invalid UTF-8 bytes, and retain the existing behavior for quoted fields and decoded strings.

Validation:

  • Four regressions fail before the fix, while two quoted-field controls already pass. All six pass afterward, including byte-sized stream chunks, Unicode whitespace, invalid UTF-8 and empty fields.
  • csv-parse suite: 566 passing, two pending, excluding the existing Windows sample-path collection failure tracked in fix: resolve sample file URLs as native paths #512.
  • TypeScript, changed-file ESLint/Prettier and git diff --check pass.

AI-assisted implementation and local verification using Codex.

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