Skip to content

"BigEndianUtf32" (UTF-32BE) character encoding identifier not supported by -Encoding parameters #11645

@mklement0

Description

@mklement0

Related: #6562

Windows PowerShell has always supported the BigEndianUtf32 value for the -Encoding parameter of file-related cmdlets such as Get-Content, Set-Content and Out-File, to specify UTF-32BE encoding.

It is the big-endian counterpart to identifier UTF32, just like the still-supported BigendianUnicode value is the counterpart to Unicode (UTF-16LE).

You can work around the issue by passing a System.Text.Encoding name directly: -Encoding utf-32be, but for symmetry and backward compatibility BigEndianUtf32 should be supported in PS Core as well.

Steps to reproduce

{ 'hi' | Set-Content -ea stop -Encoding BigEndianUtf32 temp:$Pid.txt; ri temp:$Pid.txt } |
  Should -Not -Throw

Expected behavior

The test should pass.

Actual behavior

The test fails:

Expected no exception to be thrown, but an exception 
"Cannot process argument transformation on parameter 'Encoding'. 'BigEndianUtf32' is not a supported encoding name. ...

Environment data

PowerShell Core 7.0.0-rc.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-FixedThe issue is fixed.WG-Cmdlets-Managementcmdlets in the Microsoft.PowerShell.Management module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions