Learn how to display emojis in the NetBeans code editor.

How to force Apache NetBeans to display UTF-8 unicode characters (Emojis) in the editor properly

Curiously, I started using Emojis in my code for comments and other uninteresting stuff just a couple of months ago. I started with that in React projects, where my predilect code editor is Visual Studio Code. Emojis are visible in my comments without any issue, however, for my PHP projects, I love to use Apache NetBeans. While I was working on the documentation of some project in the IDE I decided to include some emojis, but to my surprise, emojis in the default Apache NetBeans appear just as weird characters:

VSCode NetBeans Emojis
As you can see, the same text with emojis in VSCode displays them, however in NetBeans, questions marks appear instead of the emojis

Of course, when saving the file and opening it with a UTF-8 capable editor, the file was saved normally with the emojis from the NetBeans IDE. So, what's the problem then? Why do weird characters appear in NetBeans instead of my emojis?

Solution

The fix for this problem is quite simple, however, not everyone may like it. The solution is to use a font that supports Emojis, you can do this easily by accessing the font settings through Tools > Options and then go to the Fonts & Colors tab:

NetBeans Fonts & Settings

Click on Font, where you probably have a Unicode font, in my case I use Consolas which doesn't support a lot of characters. In the list of Fonts, you will find an emoji-capable font namely Segoe UI Emoji or Segoe UI Symbol:

Segoe UI Emojis Font NetBeans

Define that font as your default font, apply changes and that's it! The new font will display emojis, however not in the animated way that you'd expect but the font version of them, however, they're visible right?

Happy coding ❤️!


Senior Software Engineer at Software Medico. Interested in programming since he was 14 years old, Carlos is a self-taught programmer and founder and author of most of the articles at Our Code World.

Sponsors