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!
Last Post!
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!
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









