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

PowerShell Core 6 with PSReadLine 2 causes double CJK chars under Cmder in Windows 7 #779

Closed
chawyehsu opened this issue Oct 17, 2018 · 4 comments

Comments

@chawyehsu
Copy link

Environment data

PS version: 6.1.0
PSReadline version: 2.0.0-beta3
os: 6.1.7601.17514 (win7sp1_rtm.101119-1850)
PS file version: 6.1.0

Steps to reproduce or exception report

cap

Won't have this issue when using PSReadLine 1.2.

PC reproduce
$ dir

    Directory: C:\reproduce

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       2018/10/17     13:45                hello-world
d-----       2018/10/17     13:45                おはよう
d-----       2018/10/17     13:45                你好世界
-a----       2018/10/17     13:45              0 helloworld.txt
-a----       2018/10/17     13:45              0 你好世界.txt

PC reproduce
$ (Get-Module -Name PSReadLine).Version

Major  Minor  Build  Revision
-----  -----  -----  --------
1      2      -1     -1
@lzybkr
Copy link
Member

lzybkr commented Oct 17, 2018

Interesting, this is probably related to microsoft/terminal#280.

@DHowett-MSFT
Copy link

It's likely a combination of that and that Cmder can only act as a terminal by reading the console output buffer. When "Raster Fonts" is selected, there are some observable changes in some console output reading APIs (for compatibility with legacy applications). That may include the duplication of double-width characters.

@mwhds97
Copy link

mwhds97 commented Feb 28, 2023

I've been struggled with this issue for years, until I found a solution by chance.
Just try adding the following to your profile:

$OutputEncoding = [System.Text.Encoding]::UTF8
[System.Console]::OutputEncoding = [System.Text.Encoding]::UTF8
[System.Console]::InputEncoding = [System.Text.Encoding]::UTF8

The 3 lines above saved my conemu, vscode, etc. Hope it works for you.

@daxian-dbw
Copy link
Member

@mwhds97 Thanks for sharing the workaround. I will close this as an external issue.

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

No branches or pull requests

5 participants