"Command Function"
Iconv is a tool command used by the Linux operating system to convert text encoding formats from one type to another.
"How to use"
Iconv [OPTION ...] [-F ENCODING] [-T ENCODING] [Inputfile ...]
One, control the input and output format options:
1. Input format:
-F ENCODING,--from-code=encoding
2. Output format
-T ENCODING,--to-code=encoding
Second, control conversion problem options:
-C #丢弃不可转换的字符
--unicode-subst=formatstring #对于不可转换的以Unicode Characters Replacement
--byte-subst=formatstring #对于不可转换的以byte替代
--widechar-subst=formatstring #对于不可转换的以wide Characters Replacement
Third, control error output options:
-S,--silent #静默输出, which disables error message output on conversion issues
Iv. Information Output:
-L,--list #列出支持的所有编码格式
--help #显示命令帮助信息并退出
--version #输出版本信息并退出
"Actual Operation"
--list >./infomation.log infomation.log# convert GB2312 encoded file a.html to UTF-F gb2312-t utf-8 a.html >-F gb2312-t BIG5 a.html > b.html # Batch Conversion # first CD to the directory where the files need to be converted, execute the following command to convert the batch file format find C7>sh"iconv-f gb18030-t UTF-8 {} > {}.py" \; # The above command in the GB18030, if you convert before the code for GB2312, GB18030 instead of GB2312 can be.
If you feel that my article is useful to you, please feel free to make a reward. Your support will encourage me to continue to create!
MacOS comes with file encoding format conversion tool