-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
HKCU\Console\CodePage ... does it do anything? #11591
Comments
I just happened to be looking at this area of the code recently, so I have a general idea of how it works, and this looks like a bug to me. The place that the settings are initialized at startup is in the Lines 174 to 190 in 284257a
Note that it loads the setting from the default registry area first, then potentially overrides that with settings in the shortcut link, and if there was no shortcut link, it'll look again in the registry for settings specific to the current executable. The problem, though, is that the terminal/src/interactivity/win32/SystemConfigurationProvider.cpp Lines 58 to 70 in fb597ed
I can't see any reason why that line is necessary, and removing it seems to fix the problem. But maybe one of the core devs will have access to the git history going further back and can see why it was added. It's possible there's a legitimate reason for it. |
This seems to be by design. When conhost is started in a conpty session it deliberately doesn't initialize settings from the registry. See here: Lines 165 to 172 in 284257a
|
If I recall correctly, the default "CodePage" setting was ignored in Windows 7. It definitely worked in Windows 2000, which I think was the first version of Windows that supported it. I verified this in Windows 2000 running in a VM.
A pair of functions could be added to the API to get and set the classic console settings that are applicable in the pseudoconsole context, such as "CodePage" and "NumberOfHistoryBuffers". For example: |
If you're wanting a setting in Windows Terminal to specify the initial codepage for a profile, I think that is similar to what was requested in #9174 and/or #10870. It's also been discussed tangentially in #10408 (comment). |
I'd be happy with setting it for all profiles. If I read you correctly, @j4james, that's not currently possible. The user should have some say ... yes/no? |
Well the user does have some say. They can change the codepage with But Windows Terminal doesn't currently have any control over that (as far as I'm aware), because it's all handled in conhost. What gets passed to conpty (which is what Windows Terminal sees), is a simple stream of UTF-8 after everything has already been translated. But if this is something you need to control from within Windows Terminal itself, I'd suggest upvoting #10870, which I believe is requesting the same thing. If you have a compelling use case for it, maybe explain what that is in a comment. |
When I started this thread, I was thinking Windows should be honoring the default code page setting. The user should have some across-the-board control in consoles and in WT. I upvoted #10870 but didn't leave a use case. Today's compelling reason is that I prefer the first (below) to the second. :-)
|
If you're using a cmd shell, you could just change the command line in your Windows Terminal profile to something like this: |
... or use CMD's AutoRun file. I don't use CMD often. For any command interpreter, there are specific work-arounds. |
You know, I thought our plan of record was to actually kinda go in the opposite direction, and have conpty force itself into utf-8 mode by default - #1802. Of course, we never really achieved consensus on that one, and I don't think any of us thought it was a terribly high-priority issue. |
Thanks for filing. We think the right solution to this is going to be allow the user to set the codepage in a compatibility page of the settings UI. This work spans several issues: #10870, #9174, #15678, and #1802. So we're going to mark this as a /dup of #1802, even though it's not necessarily the perfect solution to this question, but we'll use it to do the right thing. |
Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report! |
Microsoft Windows 10 Pro for Workstations
10.0.19043.1288 (2009, 21H1)
I thought that HKCU\Console\CodePage set the default output code page for consoles (and I'm pretty sure that, at least once upon a time, it did). But it does not now. Although I have
all console apps which don't have another specification start with CP 437 (CP_OEMCP).
But if, for example, I have
then CMD will start with CP 1252.
Shouldn't HKCU\Console\CodePage be setting the default?
And (apparently unrelated to the above) how do I get all shells to use output code page 1252 when running in WindowsTerminal? They all seem to get 437.
The text was updated successfully, but these errors were encountered: