mintty / wsltty

Mintty as a terminal for Bash on Ubuntu on Windows / WSL
Other
3.11k stars 104 forks source link

Chinese characters need locale adjustment to become supported #312

Closed longware closed 2 years ago

longware commented 2 years ago

longware@HP:/mnt/c/Users/longware/Desktop$ ls ????????????_20220412111458.jpg ????????????_20220412173329.png ?????????????????????.lnk ????????? ?????????.zip ??????????????????????????????V10.txt

longware@HP:/mnt/c/Users/longware/Desktop$ dir \345\276\256\344\277\241\345\233\276\347\211\207_20220412111458.jpg \345\276\256\344\277\241\346\210\252\345\233\276_20220412173329.png \346\225\260\347\240\201\345\244\247\345\270\210\346\227\227\350\210\260\347\211\210.lnk \346\233\264\346\226\260\345\214\205 \346\233\264\346\226\260\345\214\205.zip \351\223\266\346\262\263\351\272\222\351\272\237\346\241\214\351\235\242\346\223\215\344\275\234\347\263\273\347\273\237V10.txt


Microsoft Windows [版本 10.0.19043.1586] wsltty-3.6.0-x86_64-install-portable.exe

mintty commented 2 years ago

Mintty supports Unicode, CJK character sets and all major CJK encodings. You are having a "locale" problem. If the locale set up for mintty does not match the WSL idea of locales, this will happen. Run locale -a, then select one of the locales that indicate UTF-8 encoding, and run e.g. LC_ALL=C.UTF-8 ls

longware commented 2 years ago

sudo vi /etc/profile

export LC_ALL=zh_CN.utf8 export LANG=zh_CN.utf8

sudo vi /etc/locale.gen

zh_CN GB2312 zh_CN.GB18030 GB18030 zh_CN.GBK GBK zh_CN.UTF-8 UTF-8

sudo locale-gen

Generating locales (this might take a while)... en_US.UTF-8... done zh_CN.GB2312... done zh_CN.GB18030... done zh_CN.GBK... done zh_CN.UTF-8... done Generation complete.

locale

locale -a

Problem solved, thanks!