2

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?

Tot Zam
  • 8,406
  • 10
  • 51
  • 76
TT_ stands with Russia
  • 1,785
  • 3
  • 21
  • 33

2 Answers2

6

In eclipse this prints the ying-yang for me

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

Go to Window->Preferences->General->Workspace->TextFileEncoding, set it to UTF-8

David Hofmann
  • 5,683
  • 12
  • 50
  • 78
3

For change the default console enconding, add the next line in your eclipse.ini file:

-Dfile.encoding=UTF-8
Paul Vargas
  • 41,222
  • 15
  • 102
  • 148