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

lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
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
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

Other popular topics Top

minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
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
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New

We're in Beta

About us Mission Statement