I've got the last stable Version from CsvHelper and I am missing the Encoding property:
CsvWriter csv = new CsvWriter(writer);
csv.Configuration.Encoding = Encoding.GetEncoding(1252);
WIth the CsvReader Class it's available...
Do I have to use the encoding differently now?
Jochen
That property is never used when writing. The only time it's used when reading is when you have Configuration.CountBytes turned on. The only reason it exists is because the reader/writer use TextReader and TextWriter and the encoding isn't available there.
If you want to use an encoding for reading and writing, you need to set it on the TextReader or TextWriter that you're using.
var stream = new MemoryStream();
var writer = new StreamWriter(stream, Encoding.UTF8);
var csv = new CsvWriter(writer);
Most helpful comment
That property is never used when writing. The only time it's used when reading is when you have
Configuration.CountBytesturned on. The only reason it exists is because the reader/writer useTextReaderandTextWriterand the encoding isn't available there.If you want to use an encoding for reading and writing, you need to set it on the
TextReaderorTextWriterthat you're using.