本文介绍了字符集cp852和ISO 8859-2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可能从具有字符集 cp852 .dbf 文件加载字符到

Is it possible that while loading characters from .dbf file with charset cp852 to

ArrayList<Map<String, Object>>();

并将其保存到编码为 ISO 8859-2 会发生数据丢失吗?

and save that to xml file with encoding ISO 8859-2 can occur data loss?

在Internet Explorer和Java集合中,所有字符集似乎都可以,但是当我从xml向数据库添加数据时,我的字母丢失了例如±ĄśŚ

In internet explorer and java collections all charset seems to be ok, but when I add data from xml to database I lose my letters like ą, Ą , ś, Ś

推荐答案

是的,此代码上显示的可能性很大(尽管它如果您只想导出简单字母,将会很好。

yes, it is pretty much possible as displayed on this code (though it will be fine if you only want to export simple letter).

public class Sample {
    public static void main(String[] args) throws Exception {
        // try to print Upper case A with ogonek
        System.out.println(new String(new byte[] {(byte) 164}, Charset.forName("IBM852"))); // <--- will print the correct character
        System.out.println(new String(new byte[] {(byte) 164}, Charset.forName("ISO-8859-2"))); // <--- will print something else
    }
}

供进一步参考,您可以检查这两个链接

for further reference, you could check these two links



这篇关于字符集cp852和ISO 8859-2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 10:59