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?

Tot Zam
  • 7,839
  • 9
  • 49
  • 72
TT_
  • 1,629
  • 3
  • 21
  • 31

2 Answers2

5

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,488
  • 12
  • 50
  • 76
  • The same result "?". I suppose what you suggested should work the same way as Run Dialog settings, and it does. – TT_ Jul 08 '13 at 21:49
  • Still "?". OK, no big deal, I guess something wrong with my Eclipse. Anyway, I'll probably abandon it (after I found out that to move Undo into Toolbar I have to install some plugin, come on...). – TT_ Jul 08 '13 at 22:07
  • During setting the Encoding consider to set particular OS also – Ripon Al Wasim Aug 18 '16 at 10:13
2

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

-Dfile.encoding=UTF-8
Paul Vargas
  • 40,346
  • 15
  • 98
  • 144