在 ubuntu 上运行 mosh 的客户端, 出现以下错误:
The locale requested by LC_CTYPE=UTF-8 isn't available here.
Running `locale-gen UTF-8' may be necessary.
The locale requested by LC_CTYPE=UTF-8 isn't available here.
Running `locale-gen UTF-8' may be necessary.
mosh-server needs a UTF-8 native locale to run.
Unfortunately, the local environment (LC_CTYPE=UTF-8) specifies
the character set "US-ASCII",
The client-supplied environment (LC_CTYPE=UTF-8) specifies
the character set "US-ASCII".
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=
LANGUAGE=
LC_CTYPE=UTF-8
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=
Connection to 128.199.. closed.
/usr/local/bin/mosh: Did not find mosh server startup message.
在~/.bashrc添加一行:
export LC_ALL="en_US.UTF-8"
退出 bash, 再次进入, 出现以下警告:
-bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8): No such file or directory
我们可以通过运行 locale -a 查看系统当前支持的locale定义
我们通过运行
localedef -v -c -i en_US -f UTF-8 en_US.UTF-8
生成相应的locale配置文件。之后系统就不会报错了。