Skip to content

Conversation

@SteveL-MSFT
Copy link
Member

@SteveL-MSFT SteveL-MSFT commented Oct 17, 2019

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

@SteveL-MSFT
Copy link
Member Author

@PoshChan please retry windows

@PoshChan
Copy link
Collaborator

@SteveL-MSFT, successfully started retry of PowerShell-CI-Windows

@SteveL-MSFT SteveL-MSFT force-pushed the native-outputencoding branch from a2dd585 to 3b9ccb7 Compare October 18, 2019 21:27
@iSazonov 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
@iSazonov iSazonov added this to the 7.0.0-preview.5 milestone Oct 19, 2019
@iSazonov 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
@iSazonov iSazonov merged commit 13f8ba2 into PowerShell:master Oct 19, 2019
@iSazonov
Copy link
Collaborator

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

@SteveL-MSFT SteveL-MSFT deleted the native-outputencoding branch October 19, 2019 15:56
@SteveL-MSFT
Copy link
Member Author

@iSazonov discussed that with @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
Copy link

Erhie commented Oct 26, 2019

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

@ghost
Copy link

ghost commented Nov 21, 2019

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

Handy links:

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