vishal-h

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

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

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

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!

Where Next?

Popular in Questions Top

vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

Other popular topics Top

baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 44167 214
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New

We're in Beta

About us Mission Statement