Microsoft.Jet.OLEDB.4.0 Converting Characters

Finally! Thanks to @HABJAN I was able to get to the resolution which is as simple as setting the CharacterSet in the Extended Properties of the connection string. For my situation it was UTF-8… commonly used by default in PHPMyAdmin which is where my data was retrieved from.

Resulting working connection string:

"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\"{0}\";Extended Properties=\"text;HDR=Yes;FMT=Delimited;CharacterSet=65001;\""

Key is CharacterSet=65001 (Code Page Identifiers) which might have been obvious to some collation-savvy individuals but I’ve somehow managed to avoid these issues over the years and never come across it in this respect.

I was also able to get HABJAN’s solution to work when also following the documentation found at https://learn.microsoft.com/en-us/sql/odbc/microsoft/schema-ini-file-text-file-driver and setting the CharacterSet to the same as above.

For my situation, this is the better method as it is a simpler/more maintainable solution, but +1 to HABJAN for helping me get there!

Thanks

Leave a Comment