Skip to content

fix(stdlib): unescape doubled quotes in csv.parse() quoted fields (#2239) - #2257

Merged
SchoolyB merged 1 commit into
bugfixes/august-11-2026from
fix/issue-2239
Aug 6, 2026
Merged

fix(stdlib): unescape doubled quotes in csv.parse() quoted fields (#2239)#2257
SchoolyB merged 1 commit into
bugfixes/august-11-2026from
fix/issue-2239

Conversation

@SchoolyB

@SchoolyB SchoolyB commented Aug 6, 2026

Copy link
Copy Markdown
Member

Fixes #2239

csv.parse() correctly detected doubled-quote boundaries in quoted fields but copied the raw content without unescaping "" to ". After extracting a quoted field, the parser now checks for embedded quotes and produces an unescaped copy per RFC 4180 §2.7.

Changes:

  • grayc/src/stdlib/csv.c: After quoted-field extraction, scan for "" pairs and unescape to single "
  • Added integration-tests/pass/stdlib/csv_quoted_unescape.gray with 4 test cases

@github-actions github-actions Bot added stdlib General standard library issues tests Related to unit tests or test infrastructure grayc Related to the grayscale compiler core or its internal tooling labels Aug 6, 2026
@SchoolyB
SchoolyB changed the base branch from main to bugfixes/august-11-2026 August 6, 2026 07:57
@SchoolyB
SchoolyB merged commit 84561c0 into bugfixes/august-11-2026 Aug 6, 2026
3 of 5 checks passed
@SchoolyB
SchoolyB deleted the fix/issue-2239 branch August 6, 2026 07:57
Comment thread grayc/src/stdlib/csv.c
for (int32_t k = 0; k < field_length; k++) {
buf[out++] = field_start[k];
if (field_start[k] == '"' && k + 1 < field_length && field_start[k + 1] == '"')
k++; /* skip second quote of pair */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

grayc Related to the grayscale compiler core or its internal tooling stdlib General standard library issues tests Related to unit tests or test infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: csv.parse() does not unescape doubled quotes in quoted fields

2 participants