JoshClose / CsvHelper

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

Validate Header generate a very large message. #2249

Open Hieu-Nguyen-1 opened 5 months ago

Hieu-Nguyen-1 commented 5 months ago

Describe the bug HeaderValidated() will generate a very large message when validating a file with encoding different from the configured encoding.

Expected behavior Remove the large message

Screenshots image

JoshClose commented 5 months ago

Do you mean a different CultureInfo? The delimiter is token from CultureInfo.TextInfo.ListSeparator. My guess is it's not finding a delimiter and is using that large text because of that.

This seems like a configuration issue to me.

Hieu-Nguyen-1 commented 5 months ago

Do you mean a different CultureInfo? No, it's a different Encoding. In my case, my file is Unicode Encoding, my Csv Reader Config is UTF8 Encoding. image

My guess is it's not finding a delimiter and is using that large text because of that. -> Yes.

image

args.Context.Reader.HeaderRecord = all text of a file