Roh*_*hit 9 java string encoding utf-8 cyrillic
我有一个俄语字符串,我编码为UTF-8
String str = "\u041E\u041A";
System.out.println("String str : " + str);
Run Code Online (Sandbox Code Playgroud)
当我在eclipse控制台中打印字符串时,我得到??任何人可以建议如何打印俄语字符串到控制台或我在这里做错了什么?
我已经尝试将其转换为字节使用byte myArr[] = str.getBytes("UTF-8")然后new String(myArr, "UTF-8")仍然相同的问题:-(
试试这个:
String myString = "some cyrillic text";
byte bytes[] = myString.getBytes("ISO-8859-1");
String value = new String(bytes, "UTF-8");
Run Code Online (Sandbox Code Playgroud)
或这个:
String myString = "some cyrillic text";
byte bytes[] = myString.getBytes("UTF-8");
String value = new String(bytes, "UTF-8");
Run Code Online (Sandbox Code Playgroud)
俄罗斯的主要问题是正确设置UTF-8编码.
| 归档时间: |
|
| 查看次数: |
18767 次 |
| 最近记录: |