-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
PowerShell/PowerShell-Native
#70Labels
Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aNeeds-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.WG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtimeWG-RemotingPSRP issues with any transport layerPSRP issues with any transport layer
Description
Note: It is debatable what console encoding should apply when remoting into a Window machine - the caller's or the target machine's - but (effectively) using ANSI encoding - rather than the OEM code page, as is still the default on Windows - seems like the wrong choice.
Curiously, Windows PowerShell behaves this way too.
Steps to reproduce
Run on (PS Core) on Windows:
- from an elevated session, to enable "loopback" remoting
- make sure that the calling version is enabled for remoting
& {
# Target the local machine.
$htParams = @{ ('HostName', 'ComputerName')[$env:OS -eq 'Windows_NT'] = '.' }
# On Windows, determine what edition / version to target remotely: use the caller's.
if ($env:OS -eq 'Windows_NT') {
$htParams['ConfigurationName'] = (('PowerShell.' + $PSVersionTable.PSVersion), 'microsoft.powershell')[$PSVersionTable.PSEdition -ne 'Core']
}
Invoke-Command @htParams { if ($env:OS -eq 'Windows_NT') { chcp } else { $env:LANG }; [Console]::InputEncoding.WebName; [Console]::OutputEncoding.WebName, $OutputEncoding.WebName }
}Expected behavior
Active code page: 437
ibm437 # [Console]::InputEncoding.WebName
ibm437 # [Console]::OutputEncoding.WebName
utf-8 # $OutputEncodingActual behavior
Active code page: 437
windows-1252 # !! *ANSI* code page
Codepage - 0 # !! *0* - but in effect seems to behave like ANSI
utf-8Environment data
PowerShell Core 7.2.0-preview.4
Metadata
Metadata
Assignees
Labels
Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aNeeds-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.WG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtimeWG-RemotingPSRP issues with any transport layerPSRP issues with any transport layer