FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Set the output encoding to [Console]::OutputEncoding for native commands by SteveL-MSFT · Pull Request #10824 · PowerShell/PowerShell · GitHub

Set the output encoding to [Console]::OutputEncoding for native commands - #10824

Merged
Ilya (iSazonov) merged 1 commit into
PowerShell:masterfrom
SteveL-MSFT:native-outputencoding
Oct 19, 2019
Merged

Set the output encoding to [Console]::OutputEncoding for native commands#10824
Ilya (iSazonov) merged 1 commit into
PowerShell:masterfrom
SteveL-MSFT:native-outputencoding

Conversation

Steve Lee (SteveL-MSFT) commented Oct 17, 2019
edited
Loading

Copy link
Copy Markdown
Member

PR Summary

This is a regression from Windows PowerShell due to a breaking change in .NET Core. If you don't explicitly set StandardOutputEncoding, on .NET Core it defaults to the current code page. Previously, it defaulted to Console.OutputEncoding. Fix is to restore Windows PowerShell behavior by explicitly setting StandardOutputEncoding and StandardErrorEncoding to use Console.OutputEncoding.

PR Context

Fix #10789

PR Checklist

Copy link
Copy Markdown
Member Author

PoshChan-Bot (@PoshChan) please retry windows

Copy link
Copy Markdown
Collaborator

Steve Lee (@SteveL-MSFT), successfully started retry of PowerShell-CI-Windows

Ilya (iSazonov) added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Oct 19, 2019
Ilya (iSazonov) added this to the 7.0.0-preview.5 milestone Oct 19, 2019
Ilya (iSazonov) changed the title For Native Commands, the output encoding should be set to [Console]::OutputEncoding Set the output encoding to [Console]::OutputEncoding for native commands Oct 19, 2019
Ilya (iSazonov) merged commit 13f8ba2 into PowerShell:master Oct 19, 2019

Copy link
Copy Markdown
Collaborator

Interesting, should we do the same for [Console]::InputEncoding too?

Steve Lee (SteveL-MSFT) deleted the native-outputencoding branch October 19, 2019 15:56

Copy link
Copy Markdown
Member Author

Ilya (@iSazonov) discussed that with James Truher (@JamesWTruher), it seems that the code later overwrites it with the unfortunately named $OutputEncoding (which represents the encoding of output that is input to a native command) so it didn't serve any purpose to change that code.

Erhie commented Oct 26, 2019
edited
Loading

Copy link
Copy Markdown

is it not able to type

echo €

without problems

this dialog interrupts the normal text input:

cmdlet Write-Output at command pipeline position 1
Supply values for the following parameters:
InputObject[0]: €
InputObject[1]:
€

See also

Copy link
Copy Markdown

🎉v7.0.0-preview.6 has been released which incorporates this pull request.:tada:

Handy links:

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Console]::OutputEncoding doesn't work to parse exe with unicode output

5 participants


Back | FazBrowse Home | New Git URL