I have the following problem. I have to read csv files that are delimited by '|', and some fields have large json strings in which some contain '|'. The fields are enclosed in single-quotes. How can I specify in GOLANG that the fields are enclosed in single quotes.
This is how it is setup right now:
fx := csv.NewReader(fz)
fx.Comma = '|'
fx.LazyQuotes = true
fx.FieldsPerRecord = 16
I don't see anything in GODOCS options for enclosure rules. Does anyone have a workaround for this ?
You can't, however, luckily Go is written in, well, Go.
You could copy $GOROOT/src/pkg/encoding/csv/reader.go
, then modify line 274, 289, 297 and 303 to use '\''
instead of '"'
and you're good to go.