Java中的字符编码 [英] Character Encoding in Java
本文介绍了Java中的字符编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在eclipse中,我将默认编码更改为ISO-8859-1。然后我写了这个:
In eclipse, I changed the default encoding to ISO-8859-1. Then I wrote this:
String str = "Русский язык ";
PrintStream ps = new PrintStream(System.out, true, "UTF-8");
ps.print(str);
它应正确打印 String
,如我指定 UTF-8
编码。但是,它不是打印。
It should print the String
correctly, as I am specifying UTF-8
encoding. However, it is not printing.
推荐答案
ISO-8859-1
字符编码仅支持两者之间的字符0和255,其他任何东西都可能变成'?'
The ISO-8859-1
character encoding only supports characters between 0 and 255, and anything else is likely to be turned into '?'
这篇关于Java中的字符编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文