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:
-
Checked my font – it is Consolas, ‘Courier New’, monospace, which should support UTF-8?
-
When I do chcp it displays: Active code page: 65001
-
I added json code in the settings that automatically makes the Active
-
Code Page equal to 65001 whenever I open a terminal
-
Set windows Locale to support UTF-8.
-
Uninstalled and Installed Visual Studio Code.
-
When I ran the code in PYTHON, it correctly displayed the hindi characters.
-
When I ran the code in a different IDE called Eclipse IDE, it displayed the hindi characters.
-
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.
Settings.json.user code to make UTF-8 encoding automatic (got from online)
3
Answers
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.
Exit VS Code
Use Windows File Manager , show
hidden
filesOpen
C:UsersYourUserNameAppDataRoamingCodeUsersettings.json
Add this:
Save it
Start VS Code, open your java, click
Run
.A simple and effective way: use the Code Runner extension.
Use
Run Code
to run the code after installing the extension. The result will be displayed in the OUTPUT panel