开发者

Detect the encoding from A DBF

I want to detect the encoding of DBF automatically, but the structure of DBF file doesn't cont开发者_开发百科ains any information in the header of DBF file. I used to use a DBF Viewer and it opens with a proper encoding information. So I'm not sure how they implement it.

I researched the structure of DBF file and there is a language driver id, but we don't have an ID to CodePage table, any one have clue?


I did a lot of research and found this article in Esri's official website: http://webhelp.esri.com/arcpad/8.0/referenceguide/index.htm#locales/task_code.htm

It really helps for me to convert from language id to code page; I this issue is fixed. Hope it helps others.


I found this site too that has the header structural breakdown to get codepage information.

So this, in conjunction with the other answer might help you better resolve. The link I had doesn't list all the codepages, but does give you where and values for detecting from a .DBF

In addition, Visual Foxpro has some functions to get and convert too, but I haven't explicitly tried via the latest Visual Foxpro OleDB Provider that can be used with C#.

The functions are

CPDBF() CPCURRENT() CPCONVERT()

You can check online help for Visual Foxpro to get more details on these functions. You may have to do the C# via Execute Scalar call with VFP's EXECSCRIPT() call.. something like

String MultipleCmds = "ExecScript( '[use SomeTable] + chr(13)+chr(10) + [return CPCURRENT()]' ) ";

then from your connection, execute scalar of the command above.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜