Skip to content

fix(cpp): escape control characters in tsfile-cli table output - #974

Open
ColinLeeo wants to merge 1 commit into
apache:developfrom
ColinLeeo:colin/fix-table-output-escape
Open

ColinLeeo wants to merge 1 commit into
apache:developfrom
ColinLeeo:colin/fix-table-output-escape

Conversation

@ColinLeeo

Copy link
Copy Markdown
Contributor

The readable 'table' format emitted string cells verbatim, so an embedded newline split one logical record across multiple physical lines and other control characters rendered invisibly. Downstream line-based consumers then misparsed the output with no error.

Render backslash, newline, carriage return and tab as the two-character literals \, \n, \r and \t, and every other non-printable control byte (C0 controls plus DEL) as \uXXXX. CSV and NDJSON output are unchanged.

Add unit coverage for the new table_escape() helper (named controls, unicode escapes, DEL boundary, UTF-8 passthrough, column alignment) and a CLI end-to-end test asserting exact table/csv/ndjson output for cells that embed control characters.

The readable 'table' format emitted string cells verbatim, so an embedded newline split one logical record across multiple physical lines and other control characters rendered invisibly. Downstream line-based consumers then misparsed the output with no error.

Render backslash, newline, carriage return and tab as the two-character literals \\, \n, \r and \t, and every other non-printable control byte (C0 controls plus DEL) as \uXXXX. CSV and NDJSON output are unchanged.

Add unit coverage for the new table_escape() helper (named controls, unicode escapes, DEL boundary, UTF-8 passthrough, column alignment) and a CLI end-to-end test asserting exact table/csv/ndjson output for cells that embed control characters.
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