Solve the problem of Chinese garbled in VIM edit file under Linux system

If we need to edit the files in the Linux system, we may download them locally, open them with an editor, and then replace them, or edit them online with vim. However, sometimes it may be a system problem. When opening a file with a Chinese document, Chinese garbled will appear. At this time, we need to add a label supporting Chinese in the editor.

First, open. Vimrc

vim ~/.vimrc

Second, add scripts

set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
set termencoding=utf-8
set encoding=utf-8

Save after adding.

Third, execution and operation

source ~/.vimrc

In this way, we can open the document with Chinese in VIM to see if the garbled code is missing. However, the general VPS system is built-in support of Chinese, rarely see not support.

Related Article
Method to solve the disorder of Chinese content in MySQL database submitted by PHP

Whether it is ASP or PHP programming language, or even other web languages, the basic application is nothing more than Read more

Two regular expression verification methods for PHP user registered mailbox

Generally, when we register or log in to an account on the web, we need to verify not only whether Read more

Three common methods of PHP connecting MySQL database

For PHP entry-level users, we only need to master the basic database write, read, edit, delete and other basic operations. Read more

Floating ad adaptive JS code arrangement at the bottom of mobile terminal

Yesterday, a netizen asked if it is possible to move the advertisement code at the bottom of the mobile terminal, Read more

Leave a Reply

Your email address will not be published. Required fields are marked *

To prove you're a person (not a spam script), type the security word shown in the picture.
Anti-spam image