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

This commit is contained in:
Steve Lee
2019-10-19 10:09:44 +05:00
committed by Ilya
parent 74eaf1980f
commit 13f8ba284f
2 changed files with 14 additions and 0 deletions
@@ -128,6 +128,18 @@ Describe "Native Command Processor" -tags "Feature" {
$ps.Dispose()
}
}
It "OutputEncoding should be used" -Skip:(!$IsWindows -or !(Get-Command sfc.exe)) {
$originalOutputEncoding = [Console]::OutputEncoding
try {
[Console]::OutputEncoding = [System.Text.Encoding]::Unicode
sfc | Out-String | Should -Not -Match "`0"
}
finally {
[Console]::OutputEncoding = $originalOutputEncoding
}
}
}
Describe "Open a text file with NativeCommandProcessor" -tags @("Feature", "RequireAdminOnWindows") {