A text file created under Linux Open Windows environment displays Chinese garbled problem

Source: Internet
Author: User

Cause:

Linux opened under the Windows environment to create a text file is garbled, because two kinds of operating systems in Chinese compression, in the Windows environment, the Chinese encoding is generally GBK, and in the Linux environment for the UTF-8, This results in a file that is displayed properly under Windows in a Linux environment where it is garbled to open.

Workaround:

Using the Iconv command,

Command Syntax: iconv-f fromcode [-cs] [-t Tocode [file ...]

Assuming that the garbled file name is hello.c, then the terminal can use the following command to format the conversion:

Iconv-f gbk-t UTF-8./hello.c > Hello.c.temp # convert hello.c file GBK encoding to UTF-8 encoding, and redirect as file output

You can convert the encoding format.

A text file created under Linux Open Windows environment displays Chinese garbled problem

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.