Character encoding and conversion tool for files under GnuLinux

  
/************************************ ********************************* * Author : Samson * Date : 07/03/2014 * Test platform: * 3.11.0-12-generic #19-Ubuntu * GNU bash, version 4.2.45 * ****************************** *************************************/View the encoding of the current file in GNU Linux:

You can open this file via vim and enter

:set fileencoding in control mode to view the character encoding format of the current file. The following content will be displayed at the bottom of the vim window:
fileencoding=utf-8 The meaning of the uplink is that the character encoding of this file is utf-8; then how to convert the character encoding of a file? It can be processed using the iconv command. iconv - Convert encoding of given files from one encoding to another format is generally: iconv -f utf8 -t UTF-16 foo_in.txt > foo_out.txt means converting utf8 character encoded files For the format of the character encoding format utf16, you can use the above format to view the converted file. The character encoding after testing is:

fileencoding=utf-16le

PS: You can use iconv -- The list command to view the character encoding format supported by iconv;

Copyright © Windows knowledge All Rights Reserved