Solution: securecrt displays UTF-8-encoded file garbled characters in VIM in Linux

Source: Internet
Author: User

Remember to keep it in mind. The following method does not need to change the securecrt configuration, so it does not affect the display of other Chinese characters.
Problem:
For example, if a file is UTF-8 encoded, the file header is:

 
1#! /Usr/bin/Env Python2#-*-Coding: UTF-8-*-

At this point:

Run securecrt to Linux and run Vim. The Chinese characters are garbled.

View securecrt-> session options
Terminal-> appearance: character encoding: Default

Solution:
You only need to run a line of command below Vim in Linux

 
:SetEncoding = UTF-8Termencoding = GBK

No problem with displaying Chinese characters.

However, if you change the file, there will be a problem when saving it. The prompt is "Conversion error"
Add another line

:SetFileencoding = UTF-8

 

To sum up, if you edit a UTF-8 file, run the following command in VIM:

 
:SetEncoding = UTF-8Termencoding = GBK fileencoding = UTF-8

 

Note, this article from: http://hi.baidu.com/5ih2o/item/7696810c02239b3bf3eafcd8

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.