In Windows 10’s Ubuntu subsystem (WSL), if Chinese characters appear as boxes or garbled text, you usually need to check two things at the same time: whether the system locale is set to Chinese UTF-8, and whether a usable Chinese font is installed in the terminal environment.
1. Modify the locale configuration
Edit /etc/default/locale:
sudo vim /etc/default/locale
Set or add the following content:
LANG=zh_CN.UTF-8
LANGUAGE="zh_CN:zh"
After saving, you can reopen the WSL terminal, or run the following command to make the current shell reload the environment variables:
source /etc/default/locale
You can also check the current locale with this command:
locale
If LANG is shown as zh_CN.UTF-8, the configuration has taken effect.
2. Install Chinese fonts
Install the WenQuanYi Micro Hei font:
sudo apt-get update
sudo apt-get install ttf-wqy-microhei
After installation, restart the WSL terminal and check whether Chinese text is displayed normally again.
3. If boxes are still displayed
If the locale and fonts inside WSL have both been configured, but the Windows terminal window still displays boxes, you need to check the font used by the terminal program itself. In Windows Terminal, ConHost, or another terminal emulator, change the font to one that supports Chinese, such as Microsoft YaHei, SimSun, Sarasa Mono SC, or another installed Chinese font.
Reference:
