WSL Ubuntu sets Chinese locale

Problem: garbled characters in terminal, Edge, VScode and other software

Insert image description here

Insert image description here

Solution

① Install Chinese language pack

sudo apt-get install language-pack-zh-han*

② Runtime language support check

sudo apt install $(check-language-support)

③ Modify related configuration files

sudo gedit /etc/default/locale

Replace the original content with the following:

LANG="zh_CN.UTF-8"
LANGUAGE="zh_CN:zh"
LC_NUMERIC="zh_CN"
LC_TIME="zh_CN"
LC_MONETARY="zh_CN"
LC_PAPER="zh_CN"
LC_NAME="zh_CN"
LC_ADDRESS="zh_CN"
LC_TELEPHONE="zh_CN"
LC_MEASUREMENT="zh_CN"
LC_IDENTIFICATION="zh_CN"
LC_ALL="zh_CN.UTF-8"

④ Modify environment variables

Add in the last line

Guess you like

Origin blog.csdn.net/feichangyanse/article/details/132824898