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 should support quoted content containing escaped quotes like stringified JSON #39581

Closed
cfedersp opened this issue Jun 14, 2020 · 3 comments

Comments

@cfedersp
Copy link

@cfedersp cfedersp commented Jun 14, 2020

What version of Go are you using (go version)?

$ go version
go1.12.9

Does this issue reproduce with the latest release?

YES

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/charlesfederspiel/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/charlesfederspiel/projects/golang-demos/ratelimited-priorityqueue/fanout"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/charlesfederspiel/projects/gerrit2/go/src/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/0p/wk563vb57wnbjrq60dntc2mw0000gn/T/go-build751745538=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I attempted to read a db dump containing a mix of individual column values and json that was formatted in CSV format. encoding/csv panicked on the escaped quotes within the properly quoted json.

What did you expect to see?

Quoted content should be gracefully placed into a single field value, no matter what is between the quotes.

What did you see instead?

panic

@golang golang deleted a comment Jun 14, 2020
@cfedersp
Copy link
Author

@cfedersp cfedersp commented Jun 14, 2020

is fixed by Gerrit change submitted same day.
Change-Id: I5203d6cf468185b3b8f948bc53b352bb70a1ee53

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Jun 15, 2020

Can you show us an example of data that was not correctly handled by encoding/csv? Thanks.

Note that we are very unlikely to add new features to encoding/csv at this point. There are too many variants of CSV. We will only patch the package to support the format described in RFC 4180. If your CSV data does not follow RFC 4180, you should copy and modify encoding/csv to fit your needs.

@gopherbot
Copy link

@gopherbot gopherbot commented Aug 6, 2020

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@gopherbot gopherbot closed this Aug 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.