Our Ubuntu server has always had problems displaying Chinese with the command line. Finding information on the Internet and installing zhcon still cannot solve our problem. Therefore, the possible reasons are investigated here and recorded.
Put the following settings in ~/.bashrc
, and then execute source ~/.bashrc
:
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=zh_CN.UTF-8
LC_TIME=zh_CN.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=zh_CN.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=zh_CN.UTF-8
LC_NAME=zh_CN.UTF-8
LC_ADDRESS=zh_CN.UTF-8
LC_TELEPHONE=zh_CN.UTF-8
LC_MEASUREMENT=zh_CN.UTF-8
LC_IDENTIFICATION=zh_CN.UTF-8
LC_ALL=
The most important one is the last setting LC_ALL
, because its default setting is LC_ALL=C
, C
means to override the value of LANG and all LC_* variables and set it to the system default value. Therefore, if this item is left blank, the custom setting can be adopted.
Recommended Posts