# Nimble csv parse error

**URL:** <https://forum.elixirforum.com/t/nimble-csv-parse-error/31860>\
**Category:** Questions\
**Tags:** nimblecsv\
**Created:** [May 27, 2020, 1:21pm UTC](https://forum.elixirforum.com/t/nimble-csv-parse-error/31860 "2020-05-27T13:21:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vishal-h](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/vishal-h/32/13496_2.png) [@vishal-h](https://forum.elixirforum.com/u/vishal-h)\
**Post date:** [May 27, 2020, 1:21pm UTC](https://forum.elixirforum.com/t/nimble-csv-parse-error/31860/1 "2020-05-27T13:21:46Z")

</div>

Here is a simple csv  
csv = ~s(name, [name@email.com](mailto: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 …

---

<div class="post-metadata">

**Author:** ![al2o3cr](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/al2o3cr/32/3457_2.png) [@al2o3cr](https://forum.elixirforum.com/u/al2o3cr)\
**Post date:** [May 27, 2020, 2:43pm UTC](https://forum.elixirforum.com/t/nimble-csv-parse-error/31860/2 "2020-05-27T14:43:27Z")

</div>

> [@vishal-h](#):
>
> ```elixir
> ~s(name, name@email.com, prop1, 40, prop2, "A, B", "p:q, x:y")
> 
> ```

should instead be:

```elixir
~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](https://github.com/dashbitco/nimble_csv/blob/3e869aa945b5428e59f6a05222f1a36f0bd3eb7d/lib/nimble_csv.ex#L382)

---

<div class="post-metadata">

**Author:** ![vishal-h](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/vishal-h/32/13496_2.png) [@vishal-h](https://forum.elixirforum.com/u/vishal-h)\
**Post date:** [May 27, 2020, 5:14pm UTC](https://forum.elixirforum.com/t/nimble-csv-parse-error/31860/3 "2020-05-27T17:14:55Z")

</div>

RFC [RFC 4180 - Common Format and MIME Type for Comma-Separated Values (CSV) Files](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!
