Search code examples
javavisual-studio-codeterminalutf-8special-characters

System.out.println("हि") displays "??" in Visual Studio Code Terminal - How to Stop This?


Whenever I try to print out any Hindi characters in the Visual Studio Code Terminal via System.out.println(वा);, it directly prints out a ?? instead of the proper character. BTW I am using Windows 10.

Note that this problem isn't only exclusive to Hindi characters. If I try to print "₉" it also gives me a ?.

I have tried many things:

  1. Checked my font - it is Consolas, 'Courier New', monospace, which should support UTF-8?

  2. When I do chcp it displays: Active code page: 65001

  3. I added json code in the settings that automatically makes the Active

  4. Code Page equal to 65001 whenever I open a terminal

  5. Set windows Locale to support UTF-8.

  6. Uninstalled and Installed Visual Studio Code.

  7. When I ran the code in PYTHON, it correctly displayed the hindi characters.

  8. When I ran the code in a different IDE called Eclipse IDE, it displayed the hindi characters.

  9. I am my whits end and I have seemed to try everything. Any help very much appreciated - I have been on this simple issue for 5+ hours.

Code When Running

Font Settings

Settings.json.user code to make UTF-8 encoding automatic (got from online)

Settings.json.workplace code to make UTF-8 encoding automatic (also got from online, but different place

Using UTF-8 for Windows Locale


Solution

  • You need to make sure that your current version of Java is up to date. If it is version 8, then it will not be able to process special characters, nor print them out. Thus, install the newest version of java (anything higher than 17 should work) and your characters will be able to be displayed properly.