I am using Microsoft.VisualBasic.Fileio.TextFieldParser to parse a CSV file that was created with Excel 2003. The parser is working great with the exception that it is converting extended ascii values to question marks! So if the file content was:
± 3
The TextFieldParser is returning
? 3
I have tried all of the encodings in the System.Text.Encoding package with no luck. I thought I had it with UTF7 but it was dropping other characters like replacing the + sign with a space.
Any help would be greatly appreciated.
The Microsoft.VisualBasic.Fileio.TextFieldParser defaults to UTF8 encoding, but the text file is in the system's current ANSI encoding. Use one of the constructors that take an encoding like: TextFieldParser(string path, Encoding defaultEncoding).
You can pass in System.Text.Encoding.Default for your encoding or construct a new Encoding Object passing in a code page. The default on English Windows is 1252.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With