JoshClose / CsvHelper

Library to help reading and writing CSV files
http://joshclose.github.io/CsvHelper/
Other
4.77k stars 1.07k forks source link

read quoted words #790

Closed JanLorenz77 closed 7 years ago

JanLorenz77 commented 7 years ago

I have a problem to read lines where is a quted text within the text. Then I get BadDataException.

Sample: "120903";"A";4250017302024;4250017302031;"yogurt "Alma" 3.,5%";

The problem ist the quted "Alma". It is possible to read the line with IgnoreQuotes = false?

JoshClose commented 7 years ago

No. If a field contains a " it needs to be escaped by having the field wrapped in " and the " in the field needs to be doubled "".

https://tools.ietf.org/html/rfc4180#section-2

  1. Fields containing line breaks (CRLF), double quotes, and commas should be enclosed in double-quotes. For example:

    "aaa","b CRLF bb","ccc" CRLF zzz,yyy,xxx

    1. If double-quotes are used to enclose fields, then a double-quote appearing inside a field must be escaped by preceding it with another double quote. For example:

      "aaa","b""bb","ccc"

JanLorenz77 commented 7 years ago

thank you very much for your fast help