Linux (Ubuntu)
macOS: convert between file encodings
by admin on Feb.09, 2017, under Linux (Ubuntu), MAC OS X
If you ever wondered how to convert between different file encodings such as UTF-8 or ISO-8859-9 with preinstalled tools – you can do so using a utility called iconv on macOS and many (other) Unix distributions as well.
In order to get a list of supported encodings, type:
iconv -l
The syntax for this tool is:
iconv -f old-encoding -t new-encoding oldFile.txt > newFile.txt
Let’s convert a file from UTF-16BE (Big Endian) to UTF-16LE (Little Endian)
iconv -f UTF-16BE -t UTF-16LE oldFile.txt > newFile.txt