更改 .dbf 文件的字符集 [英] Changing the Character set of a .dbf file

查看:217
本文介绍了更改 .dbf 文件的字符集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个 java 应用程序,它应该从 .dbf 或 dBase3 文件加载和打印带有法语特殊字符的数据,但它不起作用;字符未显示.

I have this java application that should load and print data with french special characters from a .dbf or dBase3 file but it doesn't work; the characters are not showing.

我问了这个问题,认为问题是相关的仅用于打印,但是如果您看到评论,您就可以理解我发现问题与数据库有关而不与打印有关,因为在向我的 JTextPane 添加特殊字符时,它会正常打印......而我尝试更改 textPane 的字符集,但仍然存在同样的问题.

I asked this question thinking that the problem was related only to the printing, but if you see the comments you can understand that i figured out that the problem was related to the database and not to the printing, since when adding a special character to my JTextPane, it prints normally... and i tried changing the character set of the textPane but still the same problem.

此外,对于那些喜欢解决难题的人来说,更复杂的问题是,当我使用 MS Access 打开我的 .dbf 文件时,字符就在那里.所以我在想,从数据库加载数据时可能会发生错误......顺便说一下,为了获取数据,我正在使用这个名为 xBaseJ 的 API,它不使用 sql,但它是自己的实现.

Also, to complicate even more the question for those out there that love solving difficult problems, when i use MS Access to open my .dbf file, the characters are there. So i'm thinking, the error probably happens while loading the data from the database... By the way, to do data fetching, i'm using this API called xBaseJ that doesn't use sql, but it's own implementation.

我希望我已经提供了所有必要的细节,而且我真的很感激任何帮助,真的......任何想法都可以帮助我找出解决方案(以及问题).

I hope i have given all the necessary details and also i'd really appreciate any help, really.. any idea could help me figure out the solution (and the problem too).

编辑现在,有了答案">Ethan Furman,我们知道问题与数据库的编码有关,即纯旧的 Ascii,与 xBaseJ API 无关.

Edit Now, with the Answer of Ethan Furman, we know that the problem is related to the encoding of database wich is Plain old Ascii and it's not related to the xBaseJ API.

现在,问题应该是:是否可以更改 dBase 数据库的编码?我该怎么做?谢谢@Ethan Furman,并提前感谢您提供与此问题相关的任何帮助.

Now, the question should be: Is it possible to change the encoding of a dBase database? And how can i do it? Thank you @Ethan Furman, And thanks in advance for any help related to this question.

推荐答案

终于,我找到了答案...

Finally, i found the answer...

首先,正如前面提到的,感谢 Ethan Furman,我发现问题与 dbf 数据库的编码有关,而与 xBaseJ API 无关.

First of all and as mentioned, thanks to Ethan Furman, i figured out that the problem was related to the encoding of the dbf Database and not to the xBaseJ API.

然后我不得不搜索几个小时来寻找可以帮助我更改 Ascii 数据库字符集的工具.我发现 Apache 的 OpenOffice 可以这样做,但问题是我的 Windows 上没有 OpenOffice,我尝试下载它 5 到 6 次,但每次都被中断,因为我的互联网连接真的很糟糕(它下载速度为 6 到 7Kbs),.exe 文件大小为 209 MB.所以我不得不更多地搜索另一个软件来完成所需的任务..我不知道我是如何发现这个 DBF Commander 不仅仅是改变字符集的.无论如何,下载了可以做所有事情的试用版,但每次执行任何操作时都会显示一个窗口,告诉您购买它:D.

Then i had to search for hours for a tool that can help me change the charset of the database which is Ascii. I found out that OpenOffice from Apache does that but the problem is that i don't have OpenOffice on my windows, and i tried to download it 5 or 6 times but every time it is interrupted since my internet connection is really really bad (it downloads at the speed of 6 to 7Kbs) and the .exe file is 209 mB. So i had to search even more for another software to do the needed task.. And i don't how i found this DBF Commander that does more than just changing the charset. Anyways, downloaded the trial version that does everything but shows a window telling you to buy it everytime you do anything :D.

最后,我将字符集从 Ascii(850 国际 MS-DOS 或其他东西)更改为 1252 Windows Ansi...aaaaand!它有效!

Finally, i changed the charset from Ascii (850 International MS-DOS or something) to 1252 Windows Ansi... aaaaand boom! it works!

我仍然认为术语codePage"、Charset"和encoding"之间存在差异,我使用它们的方式相同..但至少现在我知道它们存在,这是我学到的新东西.

I still think that there's a difference between the terms "codePage" "Charset" and "encoding" and i'm using them the same.. But at least now i know they exist, and that's a new thing that i learned.

无论如何,再次感谢 Ethan Furman,我还要感谢 Google 使这一切成为可能:D!

Anyways, thank you again Ethan Furman, and i'd like to thank Google also for making this possible :D!

这篇关于更改 .dbf 文件的字符集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆