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:
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?
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:
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:
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 ❤️!