How to use Special Chars in Java/Eclipse

2020-01-28 05:09发布

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.

What can I do?

Edit: How can I find the unicode escape sequence?

7条回答
唯我独甜
2楼-- · 2020-01-28 06:02

Expanding a bit on @Joe Lencioni answer

You can use AnyEdit Eclipse plugin (install-able from Eclipse marketplace) to easily convert Unicode text into Java Unicode escapes:

  • Select char/text with non-ASCII characters
  • right-click
  • Convert > To Unicode Notation

One minor caveat is that AnyEdit wants to save the file first which obviously is disallowed by Eclipse until you fix your text.

查看更多
登录 后发表回答