1

I'm trying to print nice yin-yang from my Java program:

System.out.println("\u262f");

Everything is OK in Netbeans (default settings): both yin-yang and other stuff in English is printed correctly. What should I do to make Eclipse to do the same? With default Eclipse setting I get only "?".

I tried to change Console Encoding in Run Dialog like suggested in extracting unicode text from mysql to java, but things get even worse (more precisely, this is output: 剅䐍੓瑯瀡ഊⴱ‍਍ਿഊ奅䱌佗ഊ坡楴ഊ〠ഊഊ㼍ੇ剅䕎ഊ奯甠捡渠杯ഊ〠ഊഊ㼍� - which one is yin-yang??).

Any suggestions?

4

2 回答 2

5

在日食中,这为我打印了阴阳

System.out.println(new String(Character.toChars(9775)));

转到Window->Preferences->General->Workspace->TextFileEncoding,将其设置为UTF-8

于 2013-07-08T21:43:07.347 回答
2

要更改默认控制台编码,请在eclipse.ini文件中添加下一行:

-Dfile.encoding=UTF-8
于 2013-07-08T22:01:01.543 回答