Linux set the Chinese character set

Copyright: code word is not easy, please indicate the source ~~ https://blog.csdn.net/m0_37190495/article/details/90231157
Reproduced, please indicate the source:
Original starting in: http://www.zhangruibin.com
article from RebornChang's blog

Linux set the Chinese character set

First, referring to the next scene: the blogger server inside a shell script to write their own, there's a lot of things Chinese character annotate notes, before displaying Chinese characters no problem, it was found today vim garbled characters.

So what causes it? Check out xshell character set display, UTF-8, no problem, it will only be a server of the Chinese character set is missing, then the next to verify.

Investigation and the reasons

First look at the system kernel

1、cat /proc/version

2、uname -a
结果如下图

The system then view the current character set

Command: locale
results below
it can be seen in the position LANG, followed by empty, then the speculation verification, the system lacks the Chinese character set, then the next is simple, it wants to install a character set.

Character Set Installation

Download Character Set

root下:yum -y groupinstall chinese-support

The character set configured into the system variables

vim /etc/sysconfig/i18n

LANG variable is set to a value: "zh_CN.UTF-8". That is: LANG = zh_CN.UTF-8
previously provided as shown below:

vim /etc/profile

Set system variables.
Edit / etc / profile file, adding a line: export LANG = zh_CN.UTF-8.

After editing save, pay attention to reload this file.
Reload command:. / Etc / profile
after reloading,
use the command echo $ LANG can see the output: zh_CN.UTF-8, set proved successful.

Also use the locale command can also see the character set has been successfully set:

effect

Re vim shell file and found no garbled characters, problem solving

Guess you like

Origin blog.csdn.net/m0_37190495/article/details/90231157