Change files' encoding recursively on Windows?

后端 未结 5 1283
小鲜肉
小鲜肉 2020-12-08 07:50

Does anybody know a tool, preferably for the Explorer context menu, to recursively change the encoding of files in a project from ISO-8859-1 to UTF-8 and other encodings? Fr

5条回答
  •  囚心锁ツ
    2020-12-08 08:42

    You could easily achieve something like this using Windows PowerShell. If you got the content for a file you could pipe this to the Out-File cmdlet specifying UTF8 as the encoding.

    Try something like:

    Get-ChildItem *.txt -Recurse | ForEach-Object {
    $content = $_ | Get-Content
    
    Set-Content -PassThru $_.Fullname $content -Encoding UTF8 -Force}  
    

提交回复
热议问题