开发者

how to display unicode characters(e.g. chinese,japanese) in java application?

I have tried below code, but only '?' gets printed instead of unicode characters.

public static void main(String s[]){
 开发者_如何学Python char i1 = 0x0ABF;
  char i2 = 0x0AFF;
  String str = "A\u0303";
  System.out.println(str);
  System.out.println(i1);
  System.out.println(i2);
}

I am using jdk1.6. Thanks for any help in advance.


This probably has more to do with the OS you are on. Java handles unicode internally, no problem but once it's written to the stdout, it's up to the console/pipe receiving it to be able to understand and print it on the screen or in the file. Windows console does not support printing unicode characters.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜