0. view the file encoding. UseFileCommand
[Root @ gm15vm02-hvm xenoprof] # file xenoprofile.install.txt
Xenoprofile.install.txt:ISO-8859Text
Lang = zh_cn.gb18030 when writing the file, encoding should be gb18030, here shows the ISO-8859, it should be because of the compatibility relationship.
I. ExploitationIconvCommand to encode and convert the File Content
The iconv command is used to convert the encoding of a specified file. By default, it is output to a standard output device, or an output file.
Usage: iconv [option...] [file...]
The following options are available:
Input/output format specifications:
-F, -- from-code = Name Original Text Encoding
-T, -- to-code = Name output Encoding
Information:
-L, -- list lists all known character sets, not all of which can be used for-F,-T options
Output Control:
-C: Ignore invalid characters from the output
-O, -- output = file: output file
-S, -- silent close warning
-- Verbose prints the progress information
-?, -- Help: Provides the system's help list
-- Usage provides brief usage information
-V, -- version print the program version number
Example:
Iconv-F gb18030-T UTF-8 xenoprofile.install.txt> a.txt
This command reads the xenoprofile.install.txt file, converts from gb18030 encoding to UTF-8 encoding, and its output is directed to the.txt file.
Refer:
Http://www.examw.com/Linux/all/104572/