Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/System.Management.Automation/utils/EncodingUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ internal sealed class ArgumentToEncodingTransformationAttribute : ArgumentTransf
{
public override object Transform(EngineIntrinsics engineIntrinsics, object inputData)
{
inputData = PSObject.Base(inputData);

switch (inputData)
{
case string stringName:
Expand Down
2 changes: 2 additions & 0 deletions test/powershell/engine/Basic/Encoding.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ Describe "File encoding tests" -Tag CI {
It "Parameter 'Encoding' should accept '<encoding>'" -TestCases @(
@{ encoding = 1251 }
@{ encoding = "windows-1251" }
# Piping the string creates a PSObject boxed value that we are testing.
@{ encoding = ("windows-1251" | Write-Output) }
) {
param ( $encoding )
$testFile = "${TESTDRIVE}/fileEncoding-$($encoding).txt"
Expand Down
Loading