Linux: Convert File Encoding with iconv

By Xah Lee. Date:

The GNU command line tool iconv does character encoding conversion.

# convert a file from utf-16 to utf-8
iconv -f utf-16 -t utf-8 file1.txt > file2.txt

iconv -l → show a list of encodings.

if you don't have iconv installed, you can also use perl's piconv. See: Perl: Convert File Encoding