将编码 ascii 文件从 utf-8 批量更改为 iso-8859-1

Enr*_*que 7 windows character-encoding conversion utf-8

可能的重复:
在 Windows 下批量转换用于编码或行尾的文件

我需要这样的工具
http://www.rotatingscrew.com/utfcast.aspx

但该工具应该做相反的事情,将多个文件从 utf-8 转换为 iso-8859-1

是否有适用于 Windows 的工具(php 脚本、批处理文件等)可以执行此操作?谢谢

Joh*_*n T 13

您可以iconvGNUWin32使用,它的工作原理与 GNU/Linux 版本相同:

iconv -f UTF-8 -t ISO-8859-1 filename.txt
Run Code Online (Sandbox Code Playgroud)

然后您可以将其与批处理一起使用,前提是您已将其添加到您的%PATH%

for /f %x in ('dir /b *.txt') do iconv -f UTF-8 -t ISO-8859-1 %x
Run Code Online (Sandbox Code Playgroud)