Convmv and iconv conversion garbled

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.