Solve Chinese garbled Characters Related to opening txt files in CentOS

Source: Internet
Author: User

In linux, we sometimes open txt files in windows and find Chinese garbled characters in the txt files normally displayed in windows.

The reason for this is that the Chinese compression methods of the two operating systems are different. In windows, the Chinese compression is generally gbk, and in linux, utf8, this causes normal display in windows.
The txt file is in garbled state in linux.

Solution: Use the iconvcommand in linux. if the garbled file name is shujujiegou.txt, enter the following command on the terminal:

[Plain] view plaincopy
  1. Iconv-fgbk-tutf8shujujiegou.txt> shujujiegou.txt. utf8

Run the ls command to view the result:
[Plain] view plaincopy
  1. $ Ls
  2. Shujujiegou.txtshujujiegou.txt. utf8

We found that the shujujiegou.txt. utf8 file was created again. After opening the shujujiegou.txt file, Chinese characters can be displayed normally.

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.