-
Notifications
You must be signed in to change notification settings - Fork 860
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
Incorrect line ending values in wsl console output #9748
Comments
To work around this issue the array output can be filtered with the following command (wsl --version | ? {$_.Replace("`0","")}) |
Thanks for reporting this @nickcampau. This is because wsl writes to stdout in unicode by default. You can work around this by setting the environment variable |
@OneBlue thanks for the tip on enabling However, I think you missed what exactly the bug was that I reported. I understand the the (default) output from wsl is Unicode (utf-16 to be exact) and that isn't an issue. What is wrong is one of the character values at the end of each line. Instead of outputting a carriage return value ( This issue as reported has not been resolved and this has been marked |
Thanks @nickcampau. I can't reproduce this though. Can you explain how you got that unicode character from wsl and how you computed its value ? |
@OneBlue I ran the following command in my PowerShell (ver 7.3.3.) console. |
Windows Version
10.0.19044.2604
WSL Version
1.1.3.0
Are you using WSL 1 or WSL 2?
Kernel Version
5.15.90.1
Distro Version
No response
Other Software
PowerShell 7.3.3
Repro Steps
I was having difficulties parsing the output from any
wsl
command with PowerShell without a bunch of additional lines getting added to the output if capturing the output into an array.Here is an example output from the version command.
Array capture output:
I saved the commands output into a file (i.e.
wsl --version > file.txt
) and discovered the cause is due to an incorrect character values placed at the end of each line.The output is little endian utf16 format and each line is separated with
\u0D00 + \u00A0
character sequence. If you look closely you'll notice that\u0D00
should be\u00D0
instead.Expected Behavior
wsl
output is in a standard character encoding with appropriate line ending character values.Actual Behavior
Output contains an invalid line ending sequence.
Diagnostic Logs
No response
The text was updated successfully, but these errors were encountered: