microsoft / microsoft/winget-cli

Garbled characters when installing an EXE

Open
#5,175 7 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Area-Output Issue-Bug
Dominant language
C++
Stars
26.4k
Forks
1.8k
Avg merge
1d 11h
Merged PRs (30d)
15

Description

Brief description of your issue

When installing an EXE, the progress bar suddenly becomes garbled characters and outputs after that are all garbled too. This is rarely seen (I just hit it once).

Console output:

C:\Users\hyrious 43s
❯ winget upgrade Microsoft.VCRedist.2015+.x64
已找到 Microsoft Visual C++ 2015-2022 Redistributable (x64) [Microsoft.VCRedist.2015+.x64] 版本 14.42.34433.0
此应用程序由其所有者授权给你。
Microsoft 对第三方程序包概不负责,也不向第三方程序包授予任何许可证。
正在下载 https://download.visualstudio.microsoft.com/download/pr/c7dac50a-e3e8-40f6-bbb2-9cc4e3dfcabe/1821577409C35B2B9505AC833E246376CC68A8262972100444010B57226F0940/VC_redist.x64.exe
  ██████████████████████████████  24.4 MB / 24.4 MB
已成功验证安装程序哈希
正在启动程序包安装...
安装程序将请求以管理员身份运行,需要提示。
已成功安装

C:\Users\hyrious 41s
❯ winget upgrade Tencent.QQ
已找到 腾讯QQ [Tencent.QQ] 版本 9.7.23.29392
此应用程序由其所有者授权给你。
Microsoft 对第三方程序包概不负责,也不向第三方程序包授予任何许可证。
正在下载 https://dldir1v6.qq.com/qqfile/qq/PCQQ9.7.23/QQ9.7.23.29392.exe
  鈻鈻鈻鈻鈻鈻鈻鈻鈻鈻鈻鈻鈻鈻鈻鈻鈻鈻鈻鈻鈻鈻鈻鈻鈻鈻鈻鈻鈻鈻   216 MB /  216 MB
宸叉垚鍔熼獙璇佸畨瑁呯▼搴忓搱甯
姝e湪鍚姩绋嬪簭鍖呭畨瑁?..
宸叉垚鍔熷畨瑁

C:\Users\hyrious 3m 22s
❯ help
For more information on a specific command, type HELP command-name

Details:

  1. When the output messes, chcp returns Active code page: 936 but this is weird, it should print 活动代码页: 936.

  2. The garbled characters looks like force printing UTF-8 chinese characters in GBK codepage, here's the reproduction:

    ❯ irb
    irb(main):001> a = '已成功验证安装程序哈希'
    => "已成功验证安装程序哈希"
    irb(main):002> puts a.force_encoding('gbk')
    宸叉垚鍔熼獙璇佸畨瑁呯▼搴忓搱甯�
    => nil
    
  3. The CMD.exe is injected by clink, it might be related. @chrisant996

Steps to reproduce

I hit this issue on running the following command:

winget upgrade Tencent.QQ

But it is highly possible that this is not the cause.

Expected behavior

The output should be normal characters like the command run before that. See the console output above.

Actual behavior

It outputs garbled characters. Specifically, the progress bar "███" becomes "鈻鈻鈻".

Environment
The command was run in [clink](https://github.com/chrisant996/clink) injected CMD.exe under Windows Terminal.

Windows: Windows.Desktop v10.0.19045.5371
系统体系结构: X64
软件包: Microsoft.DesktopAppInstaller v1.24.25200.0

Winget 目录
-------------------------------------------------------------------------------------------------------------------
日志                   %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir
用户设置               %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json
可移植链接目录(用户)   %LOCALAPPDATA%\Microsoft\WinGet\Links
可移植链接目录(计算机) C:\Program Files\WinGet\Links
可移植包根目录(用户)   %LOCALAPPDATA%\Microsoft\WinGet\Packages
可移植包根目录         C:\Program Files\WinGet\Packages
可移植包根目录 (x86)   C:\Program Files (x86)\WinGet\Packages
安装程序下载           %USERPROFILE%\Downloads

链接
----------------------------------------------------------------------------
隐私声明             https://aka.ms/winget-privacy
许可协议             https://aka.ms/winget-license
第三方声明           https://aka.ms/winget-3rdPartyNotice
主页                 https://aka.ms/winget
Windows 应用商店条款 https://www.microsoft.com/en-us/storedocs/terms-of-sale

管理员设置                                状态
------------------------------------------------
LocalManifestFiles                        已禁用
BypassCertificatePinningForMicrosoftStore 已禁用
InstallerHashOverride                     已禁用
LocalArchiveMalwareScanOverride           已禁用
ProxyCommandLineOptions                   已启用
DefaultProxy                              已禁用

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing winget upgrade Tencent.QQ in the reported clink-injected CMD.exe under Windows Terminal, then compare the console code page and output before and after installation. Done means the progress bar and subsequent Chinese messages remain readable; the issue does not name a source file or test to begin with.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
cli, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.