Original article: http://blog.163.com/yaning_softwo/blog/static/37837721201171114221611/
Download URL:
Http://download.china UNIX . Net/download/0002000/1760 .shtml
I really don't know how to name the title of this post. I mean how to create it in GBK, gb18030, gb2312, and utf8 Encoding File Implement mutual conversion.
Not all Linux distributions use one encoding. For example, redflag uses gb18030 encoding by default. Of course, this does not include modification by yourself. System Default encoding. Therefore, it is necessary to convert between encodings.
Encoding conversion is divided into two parts: Content and file name.
Content conversion:
Iconv Obviously, it is the best tool. At present, most of the codes are supported, and most systems come with them. However, gb18030 is not fully supported.
Basic usage of iconv:
Iconv-F-t-o orig_file
-F, -- from-code = Name Original Text Encoding
-T, -- to-code = Name output Encoding
-O, -- output = file: output file
Of course, you can use-l or -- list to check the currently supported encoding.
File Name Conversion
Apparently, Convmv Is a good tool to deal with this problem, he is actually Perl ProgramNot all systems are built.
The usage is also very simple:
Convmv-F gb2312-T utf8-r -- notest *
-R indicates that all subdirectories are included and the associated directories are also converted.
If no -- notest is added, the system only checks what needs to be converted without actual conversion.
Example:
Suppose there is a garbled file in "/root/Wilson/test ".
[Root @ localhost test] # convmv-F utf8-T gb2312-r -- notest *
Mv "./4x4 .txt"./4x4 .txt"
Mv "./Linux t just a few clicks. Why ??. RAR ""./Qt in Linux Programming Tutorial tutorial Chinese Version Download .rar"
Mv. PDF ""./Commonly used armsets and assembler"
Ready!
[Root @ localhost test] # ls
4x4 keyboard. txt qt 文. rar
========================================================== ==================================
OthersArticle: Http://godontop.com/175.html (this blog has other good articles)