Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(encoding/csv/stream): properly handle CR characters #2325

Merged
merged 1 commit into from
Jun 22, 2022

Conversation

uki00a
Copy link
Contributor

@uki00a uki00a commented Jun 8, 2022

CSVStream had a problem where CRs in fields and consecutive trailing CRs were not handled properly. This PR fixes that problem.

The PR also adds some test cases.

@uki00a uki00a requested review from bartlomieju and kt3k as code owners June 8, 2022 21:21
@@ -34,64 +40,9 @@ Deno.test({
},
});

Deno.test({
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These behaviors are covered by the newly added test cases

const textLine = new TextLineStream();
this.#textLine = textLine;
this.#lineReader = new StreamLineReader(textLine.readable.getReader());
this.#lines = new TextDelimiterStream("\n");
Copy link
Contributor Author

@uki00a uki00a Jun 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uses TextDelimiterStream because consecutive trailing CRs need to be kept

Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks!

@ry ry merged commit fdf5318 into denoland:main Jun 22, 2022
@uki00a uki00a deleted the csv-stream-should-properly-handle-cr-chars branch June 22, 2022 15:17
cjihrig pushed a commit to bartlomieju/deno_std that referenced this pull request Jun 28, 2022
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