We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
really need help here, as I tried both Mode = RFC4180 & Mode = Escape
The CSV file content is like below (example):
=======================================================
Header1,Header2,Header3,IntHeader,DecimalHeader,DateTimeHeader content1,"content , (i have comma inside) 2","content3",100,100.00,"04/23/2024" content2,"content ,,, (many comma inside)","content2",200,200.00,"05/01/2024"
The problem is header without double quote, field1 does not contain double quote, but field2 contain both double quote and comma inside.
How do we read such CSV file?
The text was updated successfully, but these errors were encountered:
Seems to work fine for me with defaults.
void Main() { var s = """ Header1,Header2,Header3,IntHeader,DecimalHeader,DateTimeHeader content1,"content , (i have comma inside) 2","content3",100,100.00,"04/23/2024" content2,"content ,,, (many comma inside)","content2",200,200.00,"05/01/2024" """; var config = new CsvConfiguration(CultureInfo.InvariantCulture) { }; using (var reader = new StringReader(s.ToString())) using (var csv = new CsvReader(reader, config)) { csv.GetRecords<Foo>().ToList().Dump(); } } public class Foo { public string Header1 { get; set; } public string Header2 { get; set; } public string Header3 { get; set; } public int IntHeader { get; set; } public decimal DecimalHeader { get; set; } public DateTime DateTimeHeader { get; set; } }
Sorry, something went wrong.
Sign..... really sad! it's not working in my environment.
FYI, my version is 31.0.3
I guess maybe the Unicode character inside the actual CSV file.
like below:
CsvHelper doesn't care about that. You set the encoding in your TextReader. It'll use whatever delimiter you have set up in the config.
TextReader
No branches or pull requests
really need help here, as I tried both Mode = RFC4180 & Mode = Escape
The CSV file content is like below (example):
=======================================================
Header1,Header2,Header3,IntHeader,DecimalHeader,DateTimeHeader
content1,"content , (i have comma inside) 2","content3",100,100.00,"04/23/2024"
content2,"content ,,, (many comma inside)","content2",200,200.00,"05/01/2024"
=======================================================
The problem is header without double quote, field1 does not contain double quote, but field2 contain both double quote and comma inside.
How do we read such CSV file?
The text was updated successfully, but these errors were encountered: