Converting xml from UTF-16 to UTF-8 using PowerShell

后端 未结 3 950
旧巷少年郎
旧巷少年郎 2020-12-09 09:50

What\'s the easiest way to convert XML from UTF16 to a UTF8 encoded file?

3条回答
  •  有刺的猬
    2020-12-09 10:08

    Well, I guess the easiest way is to just not care about whether the file is XML or not and simply convert:

    Get-Content file.foo -Encoding Unicode | Set-Content -Encoding UTF8 newfile.foo
    

    This will only work for XML when there is no

    
    

    line.

提交回复
热议问题