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

encoding/csv: Feature request: Specify record delimiter #12372

Closed
devchakraborty opened this issue Aug 28, 2015 · 6 comments
Closed

encoding/csv: Feature request: Specify record delimiter #12372

devchakraborty opened this issue Aug 28, 2015 · 6 comments

Comments

@devchakraborty
Copy link

It would be great to be able to specify a record delimiter for a csv.Reader. For me, I need to parse CSVs with Mac OS 9 line termination (\r only).

(I'm using Go 1.5 on Mac OS 10.10.5.)

@minux
Copy link
Member

minux commented Aug 28, 2015 via email

@devchakraborty
Copy link
Author

That's fair. Thing is, I could also wrap a TSV with a reader that converts tabs to commas, but csv.Reader.Comma exists all the same. Because .Comma exists, I figured the design goal of csv.Reader was probably convenience rather than strict RFC compliance, hence my suggestion.

@minux
Copy link
Member

minux commented Aug 29, 2015 via email

@devchakraborty
Copy link
Author

Actually, I think you do have to handle quoting for newlines in the same way - see RFC 4180 section 2.6. Commas, newlines, and double quotes can all exist within double quoted-fields.

@rsc
Copy link
Contributor

rsc commented Oct 23, 2015

If I had it to do over I would remove Comma. Old mistakes aren't justification for new ones.

If a global \r => \n conversion isn't appropriate, it's certainly easy to make a copy of encoding/csv and adjust it for your purposes. I don't believe this problem is widespread enough to justify more complexity in this already complex package.

Thanks.

@rsc rsc closed this as completed Oct 23, 2015
@gopherbot
Copy link

CL https://golang.org/cl/23401 mentions this issue.

gopherbot pushed a commit that referenced this issue May 25, 2016
The intent of this comment is to reduce the number of issues opened
against the package to add support for new kinds of CSV formats, such as
issues #3150, #8458, #12372, #12755.

Change-Id: I452c0b748e4ca9ebde3e6cea188bf7774372148e
Reviewed-on: https://go-review.googlesource.com/23401
Reviewed-by: Andrew Gerrand <adg@golang.org>
@golang golang locked and limited conversation to collaborators May 25, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants