Click here to Skip to main content
15,909,325 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi, I want to read a German dbf file. It contains umlauts which are not available in ASCII encoding. I tried to replace the "Encoding.ASCII" with "Encoding.UTF8", but without success. The ByteReader is in UTF8 mode too. I used this great snippet
Load a DBF into a DataTable[^]

Can someone help me please? :D

BTW Sorry for my bad English.
Posted
Updated 9-Aug-12 4:50am
v3
Comments
Nueman 9-Aug-12 10:53am    
Assisted OP with English.

DBF is not supporting UTF8. You probably have a code page applied (1252 I suppose), than what people call ASCII on PC-s is only one of the code pages (437). You can use Encoding.Convert[^] method to convert the data to utf8.

Something like this:

C#
Encoding wind1252 = Encoding.GetEncoding(1252);
Encoding utf8 = Encoding.UTF8;
byte[] wind1252Bytes = ...; //what you have read from the dbf field
byte[] utf8Bytes = Encoding.Convert(wind1252, utf8, wind1252Bytes);
string utf8String = Encoding.UTF8.GetString(utf8Bytes);

(source: http://stackoverflow.com/questions/5568033/convert-a-strings-character-encoding-from-windows-1252-to-utf-8[^])
 
Share this answer
 
v2
When I had problems with ASCII encoding it helped me reading this Joel On Software article[^]
I can't promise it will help you, but it may.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900