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

Code page isn't being set correctly when piping commands #1371

Closed
ItzLevvie opened this issue Aug 15, 2021 · 2 comments
Closed

Code page isn't being set correctly when piping commands #1371

ItzLevvie opened this issue Aug 15, 2021 · 2 comments
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Author-Feedback Issue needs attention from issue or PR author No-Recent-Activity Issue has no recent activity
Milestone

Comments

@ItzLevvie
Copy link

ItzLevvie commented Aug 15, 2021

Brief description of your issue

By default the code page on Windows for en-US devices is 437 (OEM - United States) but when running winget search tencent | sort it automatically switches the code page to 65001 (UTF-8) and then switches the code page back to 437 (OEM - United States)

^ This isn't an issue here because the same happens to winget search and winget list but when piping the winget search command to | sort or | find it displays corrupted characters until the code page is permanently set to 65001 (UTF-8).

Perhaps it's switching the code page back to 437 (OEM - United States) halfway through?

I am using Windows Terminal Preview here because Command Prompt doesn't support all of the special characters shown in winget search.

Steps to reproduce

  1. Clean install the latest Dev Channel build of Windows 11 on Hyper-V from ISO or VHDX.
  2. Make sure the latest Microsoft Store application updates are installed so you can receive the latest App Installer build. If not, you will likely need to go to Settings > Windows Update > Windows Insider Program > Choose your Insider settings and pick Dev; or pick Canary or Selfhost under Custom Options.
  3. winget source update
  4. winget search | sort

Expected behavior

  1. chcp 65001 - permanently set code page to UTF-8
  2. winget source update
  3. winget search tencent | sort

image

Notice how there's no corrupted characters shown.

Actual behavior

  1. winget source update
  2. winget search tencent | sort

image

Notice how there's corrupted characters shown.

Environment

Windows Package Manager (Preview) v1.3.1661-preview
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.25140.1000
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.18.1661.0

Logs: %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir

Links
---------------------------------------------------------------------------
Privacy Statement   https://aka.ms/winget-privacy
License Agreement   https://aka.ms/winget-license
Third Party Notices https://aka.ms/winget-3rdPartyNotice
Homepage            https://aka.ms/winget
Windows Store Terms https://www.microsoft.com/en-us/storedocs/terms-of-sale

Any other software?

  1. Windows Terminal Preview version 1.14.1452.0
  2. Windows Package Manager Source (winget) version 2022.620.1418.424
  3. Git version 2.37.0.rc1.windows.1

This issue is a duplicate of the now closed #1331 and was mentioned in #1300.

@ghost ghost added the Needs-Triage Issue need to be triaged label Aug 15, 2021
@KevinLaMS KevinLaMS added Issue-Bug It either shouldn't be doing this or needs an investigation. and removed Needs-Triage Issue need to be triaged labels Aug 16, 2021
@denelon denelon added this to WinGet Oct 1, 2021
@denelon denelon added this to the v1.2-Client milestone Oct 1, 2021
@denelon denelon modified the milestones: v1.2-Client, v1.3-Client Jan 8, 2022
@denelon denelon modified the milestones: v1.3-Client, v1.4-Client May 31, 2022
@denelon denelon modified the milestones: v1.4-Client, v1.5-Client Dec 28, 2022
@denelon
Copy link
Contributor

denelon commented Jan 23, 2023

@ItzLevvie, I'm digging through some of the older issues now that WinGet 1.4 is out. I'm not sure if this is actually a bug in WinGet or something else. I'd like to get it routed to the correct team. I ran across something very similar which leads me to believe that piping the output is causing the trouble here. It might even be related to this Issue at PowerShell.

We've been doing work on native PowerShell and had to structure the objects a bit differently to get sorting behavior to work as expected.

@denelon denelon added the Needs-Author-Feedback Issue needs attention from issue or PR author label Jan 23, 2023
@ghost ghost added the No-Recent-Activity Issue has no recent activity label Jan 31, 2023
@ghost
Copy link

ghost commented Jan 31, 2023

@ItzLevvie this issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment.

@ItzLevvie ItzLevvie closed this as not planned Won't fix, can't repro, duplicate, stale Feb 14, 2023
@github-project-automation github-project-automation bot moved this from To Do to Done in WinGet Feb 14, 2023
@denelon denelon removed this from WinGet Jul 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Author-Feedback Issue needs attention from issue or PR author No-Recent-Activity Issue has no recent activity
Projects
None yet
Development

No branches or pull requests

3 participants