简体   繁体   English

charset cp852和ISO 8859-2

[英]charset cp852 and ISO 8859-2

Is it possible that while loading characters from .dbf file with charset cp852 to 是否有可能在使用charset cp852加载.dbf文件中的字符时

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

and save that to xml file with encoding ISO 8859-2 can occur data loss? 并将其保存到带有ISO 8859-2编码的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 ą , Ą , ś , Ś 在Internet Explorer和Java集合的所有字符集似乎是确定,但是当我从XML数据添加到数据库中,我失去了我的信件像ąĄśŚ

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
    }
}

the result in my place will look like this 在我的位置的结果将是这样的

Ą 一种
¤ ¤

for further reference, you could check these two links 为了进一步参考,您可以检查这两个链接

http://www.ascii-codes.com/cp852.html http://www.ascii-codes.com/cp852.html
http://www.calculla.com/en/iso8859_2_table?action=showAll http://www.calculla.com/en/iso8859_2_table?action=showAll

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM