Windows Terminal rendering Cyrillic characters as (???) question marks in specific situations. #21043

Closed
opened 2026-01-31 07:31:29 +00:00 by claunia · 5 comments
Owner

Originally created by @Vuizur on GitHub (Jan 3, 2024).

Windows Terminal version

1.18.3181.0

Windows build number

10.0.19045.0

Other Software

Powershell Core 7.2.17
Powershell Locale (Get-WinSystemLocale): de-DE
Active code page: 850 (from chcp)

Steps to reproduce

I have two simple programs, one in Python, one in Java, both encoded in Text files in UTF-8.

Test.java contains:

public class Test {
    public static void main(String[] args) {
        System.out.println("Hello!");
        System.out.println("Это тест");
    }
}

test.py contains:

print("Это тест")

(Both are in a single folder with no other files.)
I execute the java file using & "C:\Program Files\Java\jdk-21\bin\java.exe" Test.java
I execute the Python file using & C:/Python312/python.exe test.py

Expected Behavior

In both cases, I expect the string to be printed as it is in the source files. So 'Это тест'.

Actual Behavior

However, executing the Python file prints:

Could not find platform independent libraries <prefix>
Это тест

So here it works flawlessly.

But executing the Java file gets the result:

Hello!
??? ????

For some reason, the Cyrillic characters get replaced by question marks here. When I use Intellij with its integrated console, the Cyrillic chars get printed correctly, so java should not be the source of error. (The java code can also print German umlauts like äö, but no Cyrillic chars.)
Both commands are executed in the same console, so it is a quite strange error.

Originally created by @Vuizur on GitHub (Jan 3, 2024). ### Windows Terminal version 1.18.3181.0 ### Windows build number 10.0.19045.0 ### Other Software Powershell Core 7.2.17 Powershell Locale (Get-WinSystemLocale): de-DE Active code page: 850 (from chcp) ### Steps to reproduce I have two simple programs, one in Python, one in Java, both encoded in Text files in UTF-8. Test.java contains: ```java public class Test { public static void main(String[] args) { System.out.println("Hello!"); System.out.println("Это тест"); } } ``` test.py contains: ```python print("Это тест") ``` (Both are in a single folder with no other files.) I execute the java file using `& "C:\Program Files\Java\jdk-21\bin\java.exe" Test.java` I execute the Python file using `& C:/Python312/python.exe test.py` ### Expected Behavior In both cases, I expect the string to be printed as it is in the source files. So 'Это тест'. ### Actual Behavior However, executing the Python file prints: ``` Could not find platform independent libraries <prefix> Это тест ``` So here it works flawlessly. But executing the Java file gets the result: ``` Hello! ??? ???? ``` For some reason, the Cyrillic characters get replaced by question marks here. When I use Intellij with its integrated console, the Cyrillic chars get printed correctly, so java should not be the source of error. (The java code can also print German umlauts like äö, but no Cyrillic chars.) Both commands are executed in the same console, so it is a quite strange error.
claunia added the Issue-QuestionNeeds-TriageIssue-BugResolution-Answered labels 2026-01-31 07:31:30 +00:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 3, 2024):

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@github-actions[bot] commented on GitHub (Jan 3, 2024): Hi I'm an AI powered bot that finds similar issues based off the issue title. Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you! ### Closed similar issues: - [Rapid Cyrillic keyboard input renders characters as questions marks (#10918)](https://github.com/microsoft/terminal/issues/10918), similarity score: 0.85 > Note: You can give me feedback by thumbs upping or thumbs downing this comment.
Author
Owner

@237dmitry commented on GitHub (Jan 3, 2024):

As a workaround, set system locale to utf8 (intl.cpl). All of console applications will be utf8.

pwsh 7.4.0

PS > & {
          [console]::OutputEncoding.EncodingName
          [console]::InputEncoding.EncodingName
          cmd /c chcp
       }
Unicode (UTF-8)
Unicode (UTF-8)
Active code page: 65001

There are no problems at all. They can only occur in older applications from the times when developers used national text encodings to localize the GUI.

@237dmitry commented on GitHub (Jan 3, 2024): As a workaround, set system locale to utf8 (intl.cpl). All of console applications will be utf8. pwsh 7.4.0 ```powershell PS > & { [console]::OutputEncoding.EncodingName [console]::InputEncoding.EncodingName cmd /c chcp } Unicode (UTF-8) Unicode (UTF-8) Active code page: 65001 ``` There are no problems at all. They can only occur in older applications from the times when developers used national text encodings to localize the GUI.
Author
Owner

@Vuizur commented on GitHub (Jan 3, 2024):

I used the official Windows settings https://superuser.com/questions/269818/change-default-code-page-of-windows-console-to-utf-8 to change it and it seems to work. Thanks!

@Vuizur commented on GitHub (Jan 3, 2024): I used the official Windows settings https://superuser.com/questions/269818/change-default-code-page-of-windows-console-to-utf-8 to change it and it seems to work. Thanks!
Author
Owner

@Vuizur commented on GitHub (Jan 3, 2024):

I see that you closed this, in my opinion it still would be nice to fix it, because for example people using Visual Studio code at schools or in workspaces won't be able to change the system encoding without admin rights, and changing the encoding is in beta and has been reportedly breaking some applications (for example some svn clients), so in some environments it might be impossible to change the encoding due to other software.

@Vuizur commented on GitHub (Jan 3, 2024): I see that you closed this, in my opinion it still would be nice to fix it, because for example people using Visual Studio code at schools or in workspaces won't be able to change the system encoding without admin rights, and changing the encoding is in beta and has been reportedly breaking some applications (for example some svn clients), so in some environments it might be impossible to change the encoding due to other software.
Author
Owner

@zadjii-msft commented on GitHub (Jan 3, 2024):

I mean, most correctly, apps should be calling SetConsoleCP if they're going to be writing text in a particular codepage to the console. Seems like python just so happens to be doing the right thing here for you. Writing utf-8 bytes to a cp850 console is most certainly not going to just work 😄

@zadjii-msft commented on GitHub (Jan 3, 2024): I mean, most correctly, apps should be calling [`SetConsoleCP`](https://learn.microsoft.com/en-us/windows/console/setconsolecp) if they're going to be writing text in a particular codepage to the console. Seems like python just so happens to be doing the right thing here for you. Writing utf-8 bytes to a cp850 console is most certainly not going to just work 😄
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#21043