How to use Special Chars in Java/Eclipse

后端 未结 7 1199
被撕碎了的回忆
被撕碎了的回忆 2020-12-01 10:39

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.

7条回答
  •  有刺的猬
    2020-12-01 11:11

    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

提交回复
热议问题