Linux: Converting a file encoded in ISO-8859-1 to UTF-8

If you have a file that is saves as ISO-8859-1 (or ISO-LATIN-1 if you like to call it that) and wish to convert it to UTF-8 you can use:

 iconv --from-code=ISO-8859-1 --to-code=UTF-8 ./oldfile.htm > ./newfile.html

This will create a new file with the converted encoding.

iconv can of of course convert to and from several other charsets. To see a list of all the encodings that iconv can work with use:

 iconv -l

If you wish to massconvert files find can be used with exec

 find . -name "*.txt" -exec iconv -f ISO-8859-1 -t UTF-8 {} -o {}.utf8 \;