How to cat a UTF-8 (no BOM) file properly/globally in PowerShell? (to another file)

后端 未结 2 1752
星月不相逢
星月不相逢 2021-02-07 13:51

Create a file utf8.txt. Ensure the encoding is UTF-8 (no BOM). Set its content to

In cmd.exe:

type utf8.txt > o

2条回答
  •  攒了一身酷
    2021-02-07 14:28

    For PowerShell 5.1, enable this setting:

    Control Panel, Region, Administrative, Change system locale, Use Unicode UTF-8 for worldwide language support

    Then enter this into PowerShell:

    $PSDefaultParameterValues['*:Encoding'] = 'Default'
    

    Alternatively, you can upgrade to PowerShell 6 or higher.

    https://github.com/PowerShell/PowerShell

提交回复
热议问题