CsvHelper icon indicating copy to clipboard operation
CsvHelper copied to clipboard

read quoted words

Open JanLorenz77 opened this issue 9 years ago • 2 comments

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?

JanLorenz77 avatar Oct 16 '17 13:10 JanLorenz77

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

  2. 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"

JoshClose avatar Oct 16 '17 14:10 JoshClose

thank you very much for your fast help

JanLorenz77 avatar Oct 16 '17 15:10 JanLorenz77