TXT file under Windows upload to Linux Chinese garbled problem

Source: Internet
Author: User

Garbled is because of the compressed files, some of the files are named in Chinese. While in the Windows Chinese encoding is generally GBK, and Linux under the Chinese encoding is generally utf8, so under Windows normally open files, to Linux is likely to appear garbled.

The workaround is to convert the file content encoding using the command iconv. For example, I have a file "Linux common command" in windows open normally, while under Linux will be garbled, the way to enter in the terminal:

Iconv-f gbk-t UTF8 inputfile > Outputifile

Note: OutputFile cannot be the same as Inputfile's name.

Then open the "outputfile" This file, the text see the garbled problem solved.

Batch renaming is required after the format is converted:

For i in ' ls '; Do MV $i $ (sed ' s/}//' <<< $i); Done


There is an important concept to note at this point, <<< is to use the following as the standard input for the preceding command


TXT file under Windows upload to Linux Chinese garbled problem

Related Article

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.