Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VSCode Java Debug Console in Terminal Not Showing Unicode Characters #524

Closed
TheFanatr opened this issue Jan 19, 2019 · 4 comments
Closed
Labels
Milestone

Comments

@TheFanatr
Copy link

If the launch.json file for the project is changed to have the console property set to integratedTerminal for the launch configuration, any Unicode characters printed to said terminal with will be replaced with plain-text question marks. This is happening because the VSCode Terminal being started is using the default Windows code page of 65000, which is ASCII, not 65001 which is UTF-8.

Environment
  • Operating System: Windows 10 1809 Build 17763.253
  • JDK version: 10.0.2
  • Visual Studio Code version: 1.30.2
  • Java extension version: 0.5.0
  • Java Debugger extension version: 1.16.0
Steps To Reproduce
  1. Use command window (F1 key by default) to select Java: Create Java Project; use it to create a new project called JavaDebugConsoleIssue.
  2. Inside the main method generated in the App.java file of the app package, paste the following line.
System.out.println("\u26a1\u2661");
  1. Change the launch.json file within the .vscode folder to include a setting in the launch configuration like so: "console": "integratedTerminal".
  2. Run the project, and see that the symbols actually printed to the console are simply question marks in the place of where the characters are supposed to be.

Java Debug Console Issue Reproduction.zip
I don't think logs for this issue will really be helpful, because the problem is with something that is not done, not with something that is not working.

Current Result
PS C:\Users\alexf\Documents\Visual Studio Code\Workspaces\Java Debug Console Issue> cd 'c:\Users\alexf\Documents\Visual Studio Code\Workspaces\Java Debug Console Issue'; & 'C:\Program Files\Java\jdk-10.0.2\bin\java' '-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=localhost:62607' '-Dfile.encoding=UTF-8' '-cp' 'C:\Users\alexf\AppData\Roaming\Code\User\workspaceStorage\881c58722dff86f4979c37a374ece66d\redhat.java\jdt_ws\jdt.ls-java-project\bin' 'app.App'
??
Expected Result

⚡♡

Additional Information

Every other type of Terminal, including the integrated PowerShell Terminal that can be launched through the VSCode menus supports running equivalent code to generate proper Unicode character output. I cannot use the VSCode Debug Console, as it does not support input streams, which my project requires. Also, running the command chcp 65001 in the terminal after a run of the program will cause subsequent runs to display the proper characters.

@TheFanatr
Copy link
Author

TheFanatr commented Jan 19, 2019

The resolution to this would be to change the launch script to run the command chcp 65001 and then cls. I have not yet found a way to make this possible.

@hwooo
Copy link

hwooo commented Feb 4, 2019

I also have this issue. I've set terminal to start in code page 65001, but debugs session is started in Debug Console so Unicode strings are displayed as broken word.

@testforstephen testforstephen added this to the 0.21.0 milestone Aug 26, 2019
@testforstephen
Copy link
Contributor

This is fixed by PR #625

@testforstephen
Copy link
Contributor

The fix is already in the new release 0.21.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants