Acceptable parameters for -Encoding option are different for Get-Content
, Set-Content
, Export-Csv
, Import-Csv
, and Out-File
.
# | cmdlet | Default | ASCII | UTF-7 | UTF-8 | UTF-16LE | UTF-16BE | UTF-32LE | UTF-32BE | Byte | Default | OEM | String | Unknown |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Get-Content | Ascii | Ascii | UTF7 | UTF8 | Unicode | BigEndianUnicode | UTF32 | BigEndianUTF32 | Byte | Default | Oem | String | Unknown |
2 | Set-Content | Ascii | Ascii | UTF7 | UTF8 | Unicode | BigEndianUnicode | UTF32 | BigEndianUTF32 | Byte | Default | Oem | String | Unknown |
3 | Export-Csv | ASCII | ASCII | UTF7 | UTF8 | Unicode | BigEndianUnicode | UTF32 | - | - | Default | OEM | - | - |
4 | Import-Csv | ASCII | ASCII | UTF7 | UTF8 | Unicode | BigEndianUnicode | UTF32 | - | - | Default | OEM | - | - |
5 | Out-File | default | ascii | utf7 | utf8 | unicode | bigendianunicode | utf32 | - | - | default | oem | string | unknown |
PS > Get-Content -Encoding Ascii BigEndianUTF32 Default String Unknown UTF7 BigEndianUnicode Byte Oem Unicode UTF32 UTF8 PS > Set-Content -Encoding Ascii BigEndianUTF32 Default String Unknown UTF7 BigEndianUnicode Byte Oem Unicode UTF32 UTF8 PS > Import-Csv -Encoding ASCII Default Unicode UTF7 BigEndianUnicode OEM UTF32 UTF8 PS > Export-Csv -Encoding ASCII Default Unicode UTF7 BigEndianUnicode OEM UTF32 UTF8 PS > Out-File -Encoding ascii default string unknown utf7 bigendianunicode oem unicode utf32 utf8