You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Carriage returns before newline characters are silently removed.
Yet the single-field record, []string{" foo1 \r\n foo2 "} will be written-out as " foo1 \r\n foo2 ", and not " foo1 \n foo2 " as I interpret the documentation (and #22746).
I use the term "blanket assertion" because that documentation doesn't differentiate between reading and writing, so I expect—and especially after reading #22746—the csv package to effectively disallow a carriage return (CR, \r).
Does the documentation need clarification? Is this a bug with the Writer?
The text was updated successfully, but these errors were encountered:
The entire section only applies to the input format (for Reader not Writer). There are clearly parts that can only be for reading (blank lines) and the examples also support that.
What version of Go are you using (
go version
)?1.20
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?Playground
What did you do?
Used the csv.Writer to write-out a string with a CRLF.
What did you expect to see?
The same string, but with the CR dropped; just LF.
What did you see instead?
The exact same string, the CRLF.
The documentation makes the blanket assertion:
Yet the single-field record,
[]string{" foo1 \r\n foo2 "}
will be written-out as" foo1 \r\n foo2 "
, and not" foo1 \n foo2 "
as I interpret the documentation (and #22746).Prints:
I use the term "blanket assertion" because that documentation doesn't differentiate between reading and writing, so I expect—and especially after reading #22746—the csv package to effectively disallow a carriage return (CR, \r).
Does the documentation need clarification? Is this a bug with the Writer?
The text was updated successfully, but these errors were encountered: