Lazy Diary @ Hatena Blog

PowerShell / Java / miscellaneous things about software development, Tips & Gochas. CC BY-SA 4.0/Apache License 2.0

Supported character encodings in Get-Content and Import-Csv (in PowerShell 2.0/4.0)

Tested in Windows 7 (Japanese).

  • Import-Csv does not have -Encoding option in PowerShell 2.0.
  • There are no option for UTF-32BE in PowerShell 2.0. (note: PowerShell ISE can handle UTF-32BE Files)
  • Import-Csv does not support Unknown and String Encoding.
  • String, Default, OEM, and without -Encoding option are the same.
  • File in UTF-16 with BOM can be read even if -Encoding option is wrong
  • UTF-32BE with BOM could be misdetermined to UTF-16BE (because starting bytes are FEFF)

f:id:satob:20170601231527p:plain