Solve vim editing files in Chinese garbled

Source: Internet
Author: User

situation 1: in CentOS or Debian and other Unix systems, when using VIM to edit the file, input Chinese, Chinese garbled:

#vim/ROOT/.VIMRC

Enter the following configuration:

Syntax on
set fileencodings=ucs-bom,utf-8,utf-16,gbk,big5,gb18030,latin1
set Fileencoding=utf-8

: Wq

Vim again when editing OK.

Explanation: Syntax on represents syntax highlighting, fileencoding represents the default file encoding when saving files, and Fileencodings indicates that Vim reads files using a sequence of coded identifiers that match from left to right.
Case 2: Files written on Windows, uploaded to Linux, vim edit garbled. The reason is that Windows uses GBK encoding by default, and on Linux, use the ICONV command to turn code:

#iconv-F gbk-t UTF-8 Test.txt-o test2.txt

Vim again when editing OK.


Case 3: in SecureCRT or Xshell ssh tools, vim editing files garbled. This is a good situation: Modify the client's encoding format. Take SecureCRT as an example: Find options---session options---terminal---appearance, charset encoding to utf-8 on the good.

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.