Closed vinaypatelce closed 9 years ago
What is the class definition for TRecord
?
I can already see one problem with your data. The header row has 3 columns, but the data row has 4. The data is ;
delimited and you have &
in one of the fields. Since there is a delimiter there, it's being parsed as the end of the field. For that to be valid, you need to escape the field with quotes.
This is what that should look like if it's valid.
Title;Description;Count
Title 123;"do & don't";3
Hello Josh,
Thanks for your reply.
TRecord is generic type that i pass in my method in which this code belong.
I dot'n have control on csv data, I'm reading third party data so i cant put quotes.
How can i solve it?
There really is nothing to do but sanitize the data before you run it through CsvHelper. The only way to tell is by a human eye looking at it. CSV data should be following RFC 4180 https://tools.ietf.org/html/rfc4180
Thank you Josh for your time and help.
Wouldn't the quotes around do & don't
make the semicolon in the middle ignored?
If you put quotes around a field, everything in the field is text of that field. It's not ignored, but not treated as a delimiter.
Hello,
I'm getting error "Conversion can not be performed" while trying to get records from csv response.
Csv response example
Below is my code section.
Here i have ";" in description filed value so while parsing with Delimiter ";" i'm getting error.
How can i handle this issue?