microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.4k stars 819 forks source link

Text piped to Out-Host displays broken characters #9615

Closed comiluv closed 1 year ago

comiluv commented 1 year ago

Version

Microsoft Windows [Version 10.0.22621.1194]

WSL Version

Kernel Version

Linux version 4.4.0-22621-Microsoft (Microsoft@Microsoft.com) (gcc version 5.4.0 (GCC) ) #1105-Microsoft Fri Jan 01 08:00:00 PST 2016

Distro Version

Ubuntu 22.04

Other Software

No response

Repro Steps

  1. Install Korean localized Windows 11
  2. pwsh
  3. wsl --help | Out-Host -Paging
  4. see error

Expected Behavior

Unicode characters are preserved

217413778-62d3d7c6-6adb-4f0f-aa9c-326c66f39d4d

Actual Behavior

Unicode characters are broken

217413831-eb4c1a6b-b6b4-4721-afd7-106f639d67b7

Diagnostic Logs

No response

comiluv commented 1 year ago

Also posted on github.com/PowerShell/PowerShell/issues/19115 some time ago

OneBlue commented 1 year ago

Thanks for reporting this @comiluv.

This issue is on the powershell side, but you can work around it with WSL_UTF8 (see https://github.com/microsoft/WSL/issues/4607#issuecomment-1203237214)

Closing since this is not a WSL issue

Jestar342 commented 1 year ago

The powershell guys closed https://github.com/PowerShell/PowerShell/issues/19115 citing the reason it is a wsl issue in comment https://github.com/PowerShell/PowerShell/issues/19115#issuecomment-1421912448

wsl --help exhibits nonstandard behavior in that it outputs UTF-16LE-encoded strings instead of respecting the console's code page.