Unreadable result when loading CSV into datatable
The old Microsoft.Jet.OLEDB.4.0
provider doesn’t support UTF-8 text files with BOM.
Let’s change the way that we save CSV with extractor.
Instead of using SaveCSVToFile()
, use the following:
using (Stream fileStream = File.OpenWrite(outputFileName))
csvExtractor.SaveCSVToStream(fileStream);
This construction will save UTF-8 file without BOM and solve the issue.