vscode-java-debug icon indicating copy to clipboard operation
vscode-java-debug copied to clipboard

VSCode Java UTF-8 does not print characters to the console

Open itayasaf1990xd opened this issue 2 years ago • 3 comments

[provide a description of the issue]

Environment
  • Operating System: Windows 10
  • JDK version: 11
  • Visual Studio Code version: 1.69.2
  • Java extension version: Microsoft Java Pack v0.25.0
  • Java Debugger extension version: latest
Steps To Reproduce

I have a problem with encoding Java System Output occurring only in Visual Studio Code. Like you can see in the image below bullet print as ? Eclipse and IntelliJ print the bullet point just fine. My program is very simple:

  1. [step 1] image

[attach a sample project reproducing the error] attach logs

Current Result

I made sure chcp is UTF-8 image

image

Expected Result

image

Additional Informations

The chcp inside VSCode terminal is Active code page: 65001 image

itayasaf1990xd avatar Aug 05 '22 09:08 itayasaf1990xd

This is a limitation of Windows terminal. If you manually run this Java command in terminal like ps and cmd, it cannot print the bullet Unicode character either.

You can try adding the setting "java.debug.settings.console." internalConsole", which will let the debugger print the program out using VS Code's built-in DEBUG CONSOLE. The DEBUG CONSOLE view can show the UTF_8 well.

testforstephen avatar Aug 05 '22 12:08 testforstephen

This is strange on another computer I was able to run it perfectly I just had to change chcp to 65001 image

But as you can see from the images on my main computer I am already on chccp 65001 but still can not get it to work any idea why?

itayasaf1990xd avatar Aug 05 '22 14:08 itayasaf1990xd

@itayasaf1990xd You could try to add a VS Code setting "java.debug.settings.vmArgs": "-Dfile.encoding=UTF-8", which will tell the debugger to use UTF-8 to run your app.

testforstephen avatar Aug 10 '22 02:08 testforstephen