Solve the problem of Chinese garbled characters in Debian9 system environment. Check the setting of UTF

888u

Last update at :2024-06-21,Edit by888u

As a general rule, no matter whether we are using mainland China or a foreign server, we should try not to have Chinese characters in the script. Some systems, especially some Chinese system sources, support Chinese, but in some systems, Chinese appears as garbled characters due to encoding problems. For example, today's Snail test environment uses the Debian9 system, and there is also a problem of Chinese garbled characters.

In this article, we will record how to set up support for Chinese without garbled characters.

First, update the source to check locales issues

Here we can apt-get update -y to the latest source, or we can change the source of Alibaba Cloud or 163. (Solution to Debian system apt-get failure to update the official source and replace the 163 source)

apt-get install locales -y

dpkg-reconfigure locales

Select zh_CN.UTF-8 and en_US.UTF-8 encoding according to our needs, and we can choose other encodings if we need them.

Then select the default ZH_CN.UTF-8 encoding.

Second, check the current locale environment

locale

If it is correct, you will see "LANG =zh_CN.UTF-8\\".

If we still see incomplete, we need to install fonts:

apt-get install ibus ibus-gtk ibus-pinyin -y

apt-get install ttf-wqy-zenhei -y

Finally we restart the server to take effect. Use vi again to check whether files with Chinese characters are garbled.

Recommended site searches: website registration price, dual-line space, .cn domain name registration, registered international domain name Taiwan server, website space registration-free, network server, registered domain name query, Internet cafe IP address query, free ASP space application,

p>

Solve the problem of Chinese garbled characters in Debian9 system environment. Check the setting of UTF

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码