本文介绍了读取DBF文件的Utf8编码问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想读一个德语的dbf文件。它包含ASCII编码不提供的变音符号。我试图用Encoding.UTF8替换Encoding.ASCII,但没有成功。 ByteReader也处于UTF8模式。我使用了这个很棒的片段
[]
有人可以帮帮我吗? :D
BTW抱歉我的英文不好。
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.
推荐答案
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);
(来源: [])
这篇关于读取DBF文件的Utf8编码问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!