vishal-h
Nimble csv parse error
Here is a simple csv
csv = ~s(name, name@email.com, prop1, 40, prop2, “A, B”, “p:q, x:y”) and parser is defined as
NimbleCSV.define(MyParser, separator: “,”, escape: “\”")
Now running the praser…
MyParser.parse_string(csv, skip_headers: false) gives the error
**** (NimbleCSV.ParseError) unexpected escape character " in ,**
What’s wrong here?
Thanks …
Marked As Solved
al2o3cr
should instead be:
~s(name,name@email.com,prop1,40,prop2,"A, B","p:q, x:y")
The CSV parser does not want a space after , and explicitly looks for escape characters immediately preceded by a separator:
https://github.com/dashbitco/nimble_csv/blob/3e869aa945b5428e59f6a05222f1a36f0bd3eb7d/lib/nimble_csv.ex#L382
Also Liked
vishal-h
RFC RFC 4180 - Common Format and MIME Type for Comma-Separated Values (CSV) Files - Spaces are considered part of a field and should not be ignored.
Thanks for the quick response, Otherwise it would have taken a while to find this out!








