Aliyun ECS Centos7 echo Chinese can be displayed normally, editing files in Chinese is garbled, how to solve it

problem description

found that their own ECS environment, linux Chinese can not be displayed properly, but also installed a Chinese language pack!

the platform version of the problem and what methods you have tried

system version number
   

what result do you expect? What is the error message actually seen?

have brothers ever encountered such a problem, and how to deal with it?

May.09,2022

I can't see the contents of your vimrc file, but I guess it may be the problem here
you try

vim /etc/vimrc

add

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

LANGUAGE variables are not correct


what echo outputs is only the code set of your current shell window, not the linux system code. You need to modify the kernel system code of linux, as follows:

method 1

modify the local environment file of the system

vi /etc/locale.conf

if

is displayed
LANG="C"

then change "C" to zh_CN.UTF-8

may show something else. As long as it is not zh_CN.UTF-8 , change the original character to zh_CN.UTF-8 to

.

reload configuration

source /etc/locale.conf

log in to the server corresponding to the shell link again

Menu