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: add field ForceQuotes to Writer #12755
Comments
CL https://golang.org/cl/15013 mentions this issue. |
Why? |
I had some compability problems, when forced to escape fields not needed to be escaped by current implementation.
Even if there is no actual specification I guess the RFC is status quo. And if you would wrap something around the writer as func WriteWrapper(w *csv.Writer, record []string) error {
for i, field := range record {
record[i] = `"` + field + `"`
}
return w.Write(record)
} you would end up with """field1""","""field2""" |
This package can't be all things to all people. Unless the compatibility problems you alluded to are widespread, I'd prefer not to add more complexity to this package. I believe this package as it stands today matches the CSV produced by Microsoft Excel and Google Drive. That should be good enough. If you really just want to print fully-quoted CSV, you don't even need this package:
|
CL https://golang.org/cl/23401 mentions this issue. |
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>
what about |
With a boolean field ForceQuotes in the csv.Writer one could force quotation of fields.
The text was updated successfully, but these errors were encountered: