skip to Main Content

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

3

Answers


  1. Chosen as BEST ANSWER

    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.


    1. Exit VS Code

    2. Use Windows File Manager , show hidden files

    3. Open C:UsersYourUserNameAppDataRoamingCodeUsersettings.json

    Add this:

    {
        "terminal.integrated.profiles.windows": {
            
            "Command Prompt": {
                "path": "C:\Windows\System32\cmd.exe",
                "args": ["-NoExit", "/K", "chcp 65001"]
                    }
        },
        "terminal.integrated.defaultProfile.windows": "Command Prompt"
    }
    
    1. Save it

    2. Start VS Code, open your java, click Run.

    Login or Signup to reply.
  2. 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

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search