Description
System Details
System Details Output
### VSCode version: 1.47.2 17299e413d5590b14ab0340ea477cdd86ff13daf x64
### VSCode extensions:
DavidAnson.vscode-markdownlint@0.36.1
fabianlauer.vs-code-xml-format@0.1.5
florianloch.text-transform@0.1.0
formulahendry.code-runner@0.11.0
idleberg.applescript@0.18.2
ms-azure-devops.azure-pipelines@1.170.0
ms-dotnettools.csharp@1.22.1
ms-python.python@2020.7.94776
ms-vscode.azure-account@0.8.11
ms-vscode.cpptools@0.29.0
ms-vscode.powershell@2020.6.0
Shan.code-settings-sync@3.4.3
slevesque.vscode-autohotkey@0.2.2
slevesque.vscode-hexdump@1.7.2
twxs.cmake@0.0.17
vitaliymaz.vscode-svg-previewer@0.5.2
### PSES version: 2.2.0.0
### PowerShell version:
Name Value
---- -----
PSVersion 7.1.0-preview.5
PSEdition Core
GitCommitId 7.1.0-preview.5
OS Microsoft Windows 10.0.18363
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Issue Description
Unlike regular console windows (and unlike PowerShell running as a regular shell in the VSCode integrated terminal), the PowerShell Integrated Console sets [console]::OutputEncoding
to UTF-8, which causes output from external programs to be interpreted as UTF-8-encoded.
However, it doesn't also set the input encoding, [console]::InputEncoding
, which not only makes sense for consistency, but has unwanted side effects:
PowerShell [Core] v6+ itself also defaults to UTF-8 in the $OutputEncoding
preference variable, which means that text sent to external programs is sent as UTF-8.
However, not setting [console]::InputEncoding
means that external programs that run the chcp
utility to infer the active OEM code page still see the system's OEM code page - this could affect how Visual Studio Code's code
CLI interprets its stdin input - see PowerShell/PowerShell#13216
Setting [console]::InputEncoding
causes chcp
to reflect the newly assigned encoding's code page (but note that using chcp
itself to change the code page from inside PowerShell doesn't work, because .NET caches the [console]
encodings).
Expected Behaviour
PS> chcp
65001 # UTF-8
Actual Behaviour
PS> chcp
437 # e.g., on US-English systems