iconv character encoding conversion

The iconv command is used to convert the encoding of the file. For example, it can convert UTF8 encoding to GB18030 encoding, and vice versa. The iconv development library under Linux includes C functions such as iconv_open, iconv_close, iconv, etc., which can be used to easily convert character codes in C/C++ programs, which is very useful in crawling web pages. Useful for class programs.
 
View file encoding format:
file txt 
// file -i txt
Format:
iconv -f encoding [-t encoding] [inputfile]...
parameter:
- f encoding : Convert characters from encoding encoding. 
- t encoding : Convert characters to encoding encoding. 
- l : list the known set of coded characters 
 -o file : specify the output file 
 - c : ignore illegal characters in output 
 - s : suppress warning messages, but not error messages 
 -- verbose : display progress information 
 -f and -t The legal characters that can be specified are listed in the command with the -l option.

 

Example:
List currently supported character encodings: 
iconv -l

Transcode the file file1, and output the converted file to fil2:

iconv file1 -f UTF-8 -t GBK -o file2 

iconv -f gbk -t utf- 8 test.cpp // need to specify -o parameter or redirection symbol>    

Here, not -oso much will be output to standard output.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325536755&siteId=291194637