Converting encoding of multiple files with iconv (Mac OS)?

Posted by Ilya Birman on Server Fault See other posts from Server Fault or by Ilya Birman
Published on 2009-05-22T05:31:00Z Indexed on 2010/05/28 12:53 UTC
Read the original article Hit count: 496

Filed under:
|
|

I need to convert a whole bunch of files from Windows-1251 to UTF-8. After doing 10 of them by hand in BBEdit, I got bored ;-) I found out that there is an iconv CL tool. I tried this:

iconv -f WINDOWS-1251 -t UTF-8 inputfile

However it seems that iconv just outputs the converted text instead of writing it to file. Also, there is no outputfile parameter for it.

How do I write the changes back to original files? Thanks.

Edit: Please note, that inputfile value is actually *.txt, so the solution has to work with that.

© Server Fault or respective owner

Related posts about macosx

Related posts about terminal