beta.blog

macOS: convert between file encodings

by 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

Leave a Reply

*

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!