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

Is there any convenient way to modify the terminal's encoding? #17273

Closed
stdmkmehp opened this issue May 15, 2024 · 5 comments
Closed

Is there any convenient way to modify the terminal's encoding? #17273

stdmkmehp opened this issue May 15, 2024 · 5 comments
Labels
Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Needs-Tag-Fix Doesn't match tag requirements Resolution-External For issues that are outside this codebase

Comments

@stdmkmehp
Copy link

Description of the new feature/enhancement

When I use ssh to connect to remote server in terminal, it is frequent to switch encoding between gbk and utf-8. But it seams that there is no way to do it. This matter is causing me a lot of distress. Plz help me!

Proposed technical implementation details (optional)

@stdmkmehp stdmkmehp added the Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. label May 15, 2024
@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 May 15, 2024
@lhecker
Copy link
Member

lhecker commented May 15, 2024

I'd love to help but can you please write more about what you mean? Ideas:

  • Are you trying to remotely connect to a Windows or Linux system?
  • How are you trying to switch the encoding?
  • What exactly breaks?
  • Can you give us steps so that we can reproduce your issue?

@carlos-zamora carlos-zamora added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label May 15, 2024
@stdmkmehp
Copy link
Author

I'm try to remotely connect to a Linux system which has env LC_ALL=C. When I do shell cmd with "cat file", the terminal shows garbled characters. The file is encoded with gbk,but it seams that terminal shows as utf-8.
To reproduce the issue, you can cat file_enc_with_gbk.txt. On my terminal, it comes with
image
Obviously it is not what i want.

I have used Xshell before, which can provide a dropdown menu to switch the terminal's encoding. If the file is encode with gbk, I just need switch the terminal's encoding to gbk. If the file is encode with utf-8, I just need switch the terminal's encoding to utf-8. Buf the Windows terminal seems take a default encoding utf-8, and do not support to switch.

file_enc_with_gbk.txt

@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 labels May 16, 2024
@lhecker
Copy link
Member

lhecker commented May 16, 2024

I'm try to remotely connect to a Linux system which has env LC_ALL=C.

LC_ALL=C in practice tells your system that you want to use ASCII. At a minimum, I would recommend setting it to zh_CN.UTF-8 if possible, or some other variant, to get Unicode support. Of course there's also zh_CN.GBK if you really need GBK encoding anywhere, but I'd recommend against using GKB long term, because it's not Unicode which makes exchanging text difficult.

Buf the Windows terminal seems take a default encoding utf-8, and do not support to switch.

Not quite. You're right in that we don't support switching the encoding (codepage) via a setting. #15678 tracks this feature request. I think it makes sense for us to have such a setting, because Gnome Terminal, Apple's Terminal, and many others got it as well.

However, I believe your issue is because Windows' OpenSSH doesn't support switching the encoding. See here: PowerShell/Win32-OpenSSH#1855 (comment) I can't imagine that this is an inherent limitation and I'm pretty sure support for other encodings could be added to OpenSSH. However, such work doesn't seem to be currently planned.

@carlos-zamora
Copy link
Member

Thanks for filing! Regarding what Leonard said above, we're going to close this as a /dup of PowerShell/Win32-OpenSSH#1855.

Copy link
Contributor

Hi! We've identified this issue as a duplicate of one that exists on somebody else's Issue Tracker. Please make sure you subscribe to the referenced external issue for future updates. Thanks for your report!

@microsoft-github-policy-service microsoft-github-policy-service bot added Resolution-External For issues that are outside this codebase and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Attention The core contributors need to come back around and look at this ASAP. labels Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Needs-Tag-Fix Doesn't match tag requirements Resolution-External For issues that are outside this codebase
Projects
None yet
Development

No branches or pull requests

3 participants