标题: 错误locale: Cannot set LC_ALL to default locale: No such file or directory [打印本页] 作者: linda 时间: 2022-9-19 12:06 标题: 错误locale: Cannot set LC_ALL to default locale: No such file or directory
===========
How would you actually set up GB18030 for Ubuntu?
sudo vi /var/lib/locales/supported.d/local
add a line
zh_CN.GB18030 GB18030
sudo locale-gen
sudo vi /etc/vim/vimrc
add
let &termencoding=&encoding
set fileencodings=utf-8,gb18030
sudo vi /etc/environment
add
LANGUAGE="zh_CN:zh:en_US:en"
GST_ID3_TAG_ENCODING=GB18030
LANG=zh_CN.GB18030
LC_CTYLE=zh_CN.GB18030
quit wsl and relogin
===============
错误:
locale: Cannot set LC_ALL to default locale: No such file or directory
locale: Cannot set LC_CTYPE to default locale: No such file or directory locale
Failed to set locale, defaulting to C
setlocale: LC_ALL: cannot change locale (en_US.utf8): No such file or directory
My /usr/share/i18n/locales and /usr/share/i18n/charmaps folders were completely empty. No amount of reinstalling packages seemed to fix this. I finally took the contents of the folder from another instance that was working fine, then ran sudo localedef -i en_US -f UTF-8 en_US.UTF-8 to generate the locale information for me. locale -a now shows en_US as available and all my errors are gone.
参考:https://serverfault.com/questions/788927/missing-locales-on-centos-7