The Iconv command is a common command for file transcoding under Linux, and file transcoding is a frequent operation for students who are using both Windows and Linux systems.
1. Command format:
Iconv [Options ...] [File ...]
2. Command function:
Converts the encoding of a given file.
3. Common parameters:
Input/output format specification:
-F,--from-code= name original text encoding
-T,--to-code= name output encoding
Information:
-L,--list enumeration of all known character sets
Output control:
-C ignores invalid characters from output
-O,--output=file output file
-S,--silent off warning
--verbose Printing Progress Information
-?,--Help gives a list of the systems
--usage gives a brief usage information
-V,--version print program version number
4. Common examples:
Example 1: List the currently supported character encodings:
Command
Example: 2: File transfer utf-8 encoding
Command:
ICONV ABC. sh -o UTF8 #将文件转换成utf8格式
Example 3: File GBK encoding to UTF-8 encoding
Command:
Iconv test.txt-f gbk-t utf-8 -o test2.txt
Example 4: transcode the file file1, and then output the file to Fil2:
Command:
#iconv- f gbk-t utf-8 file1 - o file2 //Not-O output to standard output.
Example 5:gb2312 encoding to UTF-8 encoding
Command:
Iconv-f gb2312-t utf-8 file1 >-F gb2312-t utf-8 file1-o file2
Linux Common commands: Iconv command