How can I set the character set?

I open a DBF file with Microsoft.Jet.OLEDB.4.0 provider in c#.

The data that I have to insert in the file contains characters like é, è, à (is a French application), and those characters are replaced by ",", "Š"....

I want to define a character set (I think is ISO 8859-1). How can I do it?

Thank you

Juan Diego Garcés

1 answer

I found this, and it works fine for me:

// Voir site: http://msdn.microsoft.com/fr-fr/library/system.text.encoding%28v=vs.80%29.aspx

// Liste de tous les encodages possibles

bTextArray = Encoding.GetEncoding(Encoding.Default.CodePage).GetBytes(DataRead);  
// DataRead is data from a field of DB

strConverted = Encoding.Unicode.GetString((Encoding.Convert(Encoding.GetEncoding(850), Encoding.Unicode, bTextArray)));  
// 850: ibm850

With these two lines it is possible to read data from DB and to write if you take strConverted and you write it into DB.