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

Setting to choose codepage of new terminal session for each profile. #15678

Open
qqkookie opened this issue Jul 8, 2023 · 4 comments
Open

Setting to choose codepage of new terminal session for each profile. #15678

qqkookie opened this issue Jul 8, 2023 · 4 comments
Labels
Area-Settings Issues related to settings and customizability, for console or terminal Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Product-Conpty For console issues specifically related to conpty Product-Terminal The new Windows Terminal.
Milestone

Comments

@qqkookie
Copy link

qqkookie commented Jul 8, 2023

Description of the new feature/enhancement

Let user to set initial/startup codepage(CP) of new terminal session in each terminal profile setting.
The "Advanced" or "Appearance" setting of "Default" profile and each profile will have radio buttons or dropdown menu to choose one of:

  • Do nothing (old behavior, user default CP unless registry setting is modified. )
  • UTF-8 (CP 65001)
  • Windows-1252 (CP 1252, extended US-ASCII similar to ISO-8859-1(West European CP)
  • Force user default CP, regardless of CP related registry settings.
  • (Optional) Custom CP chosen by user.

Currently, each terminal session starts with CP of user-default CP. If the CP doe not match what user want, user have to change manually CP with chcp.com command or automatically with adding chcp.com to HKCU\SOFTWARE\Microsoft\Command Processor\"AutoRun" registry or modify HKCU\Console\"CodePage" registry entry. All these measures are cumbersome and inflexible. Hard to change setting. Other issue even proposed to set UTF-8 as default CP.

Proposed technical implementation details (optional)

Implement and execute function of CHCP.com command in the terminal session start up routine as chose in the profile setting.

@qqkookie qqkookie added the Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. label Jul 8, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Jul 8, 2023
@qqkookie qqkookie changed the title Initial terminal codepage for each profile. Setting to choose codepage of new terminal session for each profile. Jul 8, 2023
@zadjii-msft
Copy link
Member

Out of curiosity, do you have a specific reason for that much fine-grained control/? We've got a mind to just default all Terminal sessions to the UTF-8 codepage by default (#1802), with an opt-out to "use the user default codepage". It's {{current_year}} after all, and apps should be doing utf-8 now. But if you've got a more specific use case in mind, that'd be important to know.

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something No-Recent-Activity This issue/PR is going stale and may be auto-closed without further activity. labels Jul 10, 2023
@microsoft-github-policy-service

This comment was marked as outdated.

@qqkookie
Copy link
Author

qqkookie commented Jul 23, 2023

Out of curiosity, do you have a specific reason for that much fine-grained control/? We've got a mind to just default all Terminal sessions to the UTF-8 codepage by default (#1802), with an opt-out to "use the user default codepage". It's {{current_year}} after all, and apps should be doing utf-8 now. But if you've got a more specific use case in mind, that'd be important to know.

Current default behavior of CJK Windows console (Cmd.exe/Mintty/MSTerminal) is setting CJK localized OEM code page like CP-949 (Korea), CP-932 (Japan), CP-936 (Mainland China) etc on session start up. It is old behavior inherited from ancient MS-DOS days. Many non-Unicode (MBCS) Win32 programs (like many old Korean/Japanese games) and console mode command line tools are localized to such MBCS CJK OEM codepage. Not message catalog-localized (or language resource fork) , but hard-coded in exe file code text! Such MBCS tradition has lasted for nearly 30 years. Japanese games steadfastly utilized MBCS code until recently. That is why Application Locale Emulation tool is still used.

There exists Windows system setting option to set UTF-8 (CP-65001) as default MBCS codepage for non-Unicode (MBCS) program. But it is quite unstable and causes many compatibility issue with such MBCS Win32 program. And requires reboot PC to switch default codepage. It is machine-wide (not user-wide) global setting and requires manual registry tweaking and rebooting. So setting UTF-8 (CP-65001) as default MBCS codepage is hardly used by CJK users. CJK codepage CP-949, CP-932 , CP-936 as default MBCS codepage will not go way for CJK Windows user any time soon.

Current best practice is to execute "CHCP 949" or "CHCP 65001" manually at each new console session startup. Quite a nuisance. And it does not work for PowerShell. Auto executing CHCP at session startup with registry setting or Shortcut link is not flexible enough. But to work with UTF-8/Linux based environment like WSL(Windows subsystem for Linux) or Git tool, or MSYS2/MinGW tools, we need frequent UTF-8 console window.

So setting UTF-8 codepage for selected console session (without changing global Windows default MBCS setting) would be quite handy for user working in UTF-8/CP-949 mixed codepage environment.

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something No-Recent-Activity This issue/PR is going stale and may be auto-closed without further activity. labels Jul 23, 2023
@lhecker lhecker added Needs-Discussion Something that requires a team discussion before we can proceed Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Attention The core contributors need to come back around and look at this ASAP. labels Jul 24, 2023
@carlos-zamora carlos-zamora reopened this Jul 31, 2023
@carlos-zamora carlos-zamora removed the Needs-Discussion Something that requires a team discussion before we can proceed label Jul 31, 2023
@zadjii-msft zadjii-msft added Product-Conpty For console issues specifically related to conpty Product-Terminal The new Windows Terminal. and removed Needs-Attention The core contributors need to come back around and look at this ASAP. labels Aug 1, 2023
@carlos-zamora carlos-zamora added this to the Terminal v1.20 milestone Aug 2, 2023
@carlos-zamora carlos-zamora added Area-Settings Issues related to settings and customizability, for console or terminal and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Aug 2, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added Needs-Tag-Fix Doesn't match tag requirements and removed Needs-Tag-Fix Doesn't match tag requirements labels Aug 2, 2023
@zadjii-msft
Copy link
Member

zadjii-msft commented Aug 9, 2023

We need to dedupe some of this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Settings Issues related to settings and customizability, for console or terminal Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Product-Conpty For console issues specifically related to conpty Product-Terminal The new Windows Terminal.
Projects
None yet
Development

No branches or pull requests

4 participants