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

7

2

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

Enrique

Posted 2009-11-11T16:55:26.997

Reputation: 285

Question was closed 2010-02-25T18:33:41.467

most of those questions are about converting TO utf-8, but any of those batch tools should be able to convert in either direction. – quack quixote – 2009-11-11T17:14:54.540

Answers

13

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

John T

Posted 2009-11-11T16:55:26.997

Reputation: 149 037

"iconv.exe -c -f UTF-8 -t ISO-8859-1//TRANSLIT input.gpx > output.gpx" didn't work for me at all: https://postimg.cc/image/nzet60ze5/

– OverTheRainbow – 2018-08-28T10:29:42.703

Iff the Windows port is at least half-way sane (I know, many of them aren't and GNUWin32 was a long-time offender in that area) you could simply pass *.txt to iconv. I never really expect it from ported applications but sometimes there are people with an eye for details working on them and then such things are fixed and globbing is done within the application. Might be the case here. – Joey – 2009-11-12T07:50:40.043

Great! worked great!! – Enrique – 2009-11-13T16:53:02.470

1I installed this, but the command gives me a "file not found" message but the file is there. I'm supposed to run this on windows console, right? – darksoulsong – 2013-09-07T23:12:50.420

4

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

David R Tribble

Posted 2009-11-11T16:55:26.997

Reputation: 226

link dead? or is it just that my IP is blocked? The requested URL was rejected. If you think this is an error, please contact the webmaster. – Bizhan – 2019-06-02T13:12:10.820

Great! I'll try it. I wish I could select multiple answers. Thanks!! – Enrique – 2009-11-13T16:39:00.890

1Well, you can upvote as many good answers as you want. – David R Tribble – 2009-11-13T22:23:51.960

0

ConvertEncoding link is now dead - use either of these programs which will encode the files for you:

Sathyajith Bhat

Posted 2009-11-11T16:55:26.997

Reputation: 58 436

The link to ConvertEncoding is dead. – Stephan – 2011-11-10T11:29:23.060

Great! I'll try it. I wish I could select multiple answers. Thanks!! – Enrique – 2009-11-13T16:57:12.617