How can I use/display characters like ♥, ♦, ♣, or ♠ in Java/Eclipse?
When I try to use them directly, e.g. in the source code, Eclipse cannot save the file.
It can be solved by setting encoding in eclipse:
1st way:
At the menu select File-->Properties and then at the "Text file encoding" section: Select Other radio, Select UTF-8 from combo -> Lastly click OK button
2nd way:
Right click on specific file (say Test.java) -> Properties. In Text file encoding section: Select Other radio, Select UTF-8 from combo -> Lastly click OK button
3rd way:
If you want to make this change for all your project go at Window-->Preferences--> General--> Workspace . In Text file encoding section: Select Other radio, Select UTF-8 from combo -> Lastly click OK button