-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
encoding/csv: writer.UseCRLF will change \n to \r\n in data field #36445
Comments
after a further comparison to
though there seem no good standard on My suggestion will be simply fix |
The godoc currently documents the behavior:
Given that this is specified behavior, we can't change it. At best, we can add a |
well but i think we're talking about the only explanation is: If UseCRLF is true, the Writer ends each output line with \r\n instead of \n. i suggest we add a
so that by enabling it, |
So the problem here is with
which is shown as
|
Ms-excel will interpretive the |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
trying to write
into csv file
but the newline in
asd\njk
has been change toasd\r\njk
playground
What did you expect to see?
\n
in data field would not be changed bywriter.UseCRLF
"col1,col2\r\n\"asd\njk\",2g9\r\n"
What did you see instead?
"col1,col2\r\n\"asd\r\njk\",2g9\r\n"
The text was updated successfully, but these errors were encountered: