To determine the character encoding of the file, we use a command-line tool called "File". Because the file command is a standard UNIX program, we can find it in all modern Linux distributions.
Run the following command:
$ file–mime-encoding filename (I'll just file on mac OK)
The next step is to see what kind of file encoding your Linux system supports. To do this, we use the tool named Iconv and the "-l" option (lowercase for L) to list all currently supported encodings.
$ iconv-l
The Iconv tool is part of the GNU libc library, so it is out of the box in all Linux distributions.
After we have selected the target encoding in the encoding supported by our Linux system, run the following command to complete the encoding transformation:
$ iconv-f old_encoding-t new_encoding filename
For example, convert iso-8859-1 encoding to UTF-8 encoding:
$ iconv-f iso-8859-1-t utf-8 input.txt
Getting Started with Linux system learning: How to change the character encoding of a text file in Linux