Batch change encoding ascii files from utf-8 to iso-8859-1 [duplicate]

Possible Duplicate:
Batch-convert files for encoding or line ending under Windows

I need a tool like this
http://www.rotatingscrew.com/utfcast.aspx

But the tool should do the opposite, convert multiple files from utf-8 to iso-8859-1

Is there any tool (php script, batch file, etc.) for Windows that can do this? Thanks


Solution 1:

You can use iconv from GNUWin32, it works the same as the GNU/Linux counterpart:

iconv -f UTF-8 -t ISO-8859-1 filename.txt

you can then use it with batch, provided you've added it to your %PATH%:

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

Solution 2:

I wrote a DOS/Windows shell utility to do this. The source code is open source C++, so it can be ported to other systems.

Look for crlf.cppat david.tribble.com/src/src.html
The executable is at david.tribble.com/programs.html