The solution of ubuntu server Chinese garbled code problem
- 2020-09-16 07:51:36
- OfStack
I bought the server of Aliyun before. Later, When I edited Chinese characters on it, I found some solutions on the Internet. They were quite messy and some of them were not very easy to use.
check
Check to see if Chinese package support is installed. Terminal input:
sudo dpkg -l
Check whether Chinese support is installed (
language-pack-zh
).
The installation
If there is no installation, the terminal executes the command:
apt-get install language-pack-zh
Configure locale variables
vim /etc/environment
Add the following two lines below:
LANG="zh_CN.UTF-8"
LANGUAGE="zh_CN:zh:en_US:en"
Open file:
sudo vim /var/lib/locales/supported.d/local
Add es23EN_ES24en.GB2312 character set as follows:
en_US.UTF-8 UTF-8
zh_CN.UTF-8 UTF-8
zh_CN.GBK GBK
zh_CN GB2312
After saving, execute the command:
sudo locale-gen
Set the system default language
vim Editor edits documents:
sudo vim /etc/default/locale
Is amended as:
LANG="zh_CN.UTF-8"
LANGUAGE="zh_CN:zh:en_US:en"
sudo reboot
Restart Ubuntu and the next login will be in Chinese. But also solved the system Chinese disorderly code phenomenon.
conclusion