/********************************************************************* * Author : Samson * Date : 07/03/2014 * Test platform: * 3.11.0-12-generic #19-Ubuntu * GNU bash, version 4.2.45 * *******************************************************************/
View the encoding method of the current file in GNU Linux:
You can use vim to open this file and enter
: Set fileencoding: You can view the character encoding format of the current file. The following content is displayed under the vim window:
Fileencoding = UTF-8
The uplink indicates that the character encoding of this file is UTF-8;
How can we convert the character encoding of a file?
You can use the iconv command for processing,
Iconv-Convert encoding of given files from one encoding to another
The format is generally:
Iconv-f utf8-t UTF-16 foo_in.txt> foo_out.txt
This means to convert the utf8 character encoding file to the utf16 character encoding format. You can use the preceding format to view the converted file. The entered character encoding is as follows:
Fileencoding = utf-16le
PS: You can use the iconv -- list command to view the character encoding formats supported by iconv;