Skip to content

Non-ASCII char support for Windows terminals #622

Description

@Eskibear

When launching in integrated/external terminal, the debugger passes commands to vscode, and vscode assembles and sends it to the terminal. But if there's non-ascii char in code/path, the java process will have unexpected behavior, because of bad Unicode support in Windows.

Either VS Code or the extension should do something to cover these cases.

Example

Folder structure:

中文目录
├── Hello.class
└── Hello.java
0 directories, 2 files

Content of file 中文目录/Hello.java:

public class Hello {
  public static void main(String[] args) {
    System.out.println("中文");
  }
}

a) on Mac OSX

Works as expected

$> java -cp 中文目录 Hello
中文

b) on Windows

Non-ASCII char in classpath

Classpath is not correctly recognized by Java, if it contains non-ascii char.

D:\Test>java -cp 中文目录 Hello
Error: Could not find or load main class Hello

Non-ASCII char in stdout

cd into the folder, the classpath is correctly recognized now, but the terminal fails to print non-ascii chars.

D:\Test>cd 中文目录

D:\Test\中文目录>java -cp . Hello
ä??æ??

To display non-ascii char in Windows terminals, you have to modify the code page, see https://ss64.com/nt/chcp.html

Workaround: set code page to 65001 (utf-8)

D:\Test\中文目录>chcp 65001
Active code page: 65001

D:\Test\中文目录>java -cp . Hello
中文

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions