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 …

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:

1 Like

RFC https://tools.ietf.org/html/rfc4180 - 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!

1 Like