Click to See Complete Forum and Search --> : Encoding of CSV


dummyagain
December 20th, 2006, 03:34 AM
I import the CSV in the database and I use dataTable to read the contents of CSV file first. The CSV files contains both english and traditional chinese characters. However, after importing the csv, the chinese characters are all mess code. I would like to know how to correct the encoding of the CSV file to make it able to store the chinese characters.


string content = File.ReadAllText(SaveLocation);

Thank you

hitai
December 26th, 2006, 12:20 AM
What encoding do u use for the CSV file?

dummyagain
December 26th, 2006, 01:30 AM
utf-8

hitai
December 28th, 2006, 09:14 AM
i think u need to specify the encoding to use when retriving the text from the file. something like File.ReadAllText(SaveLocation, Encoding.Utf8);