mosh 的字符编码/UTF-8 问题

mosh 的字符编码/UTF-8 问题

总是,当我在树莓派上安装 mosh 并尝试通过我的电脑连接时,出现以下错误:

lz@blade:~$ mosh -ssh="ssh -p 2323" [email protected]
[email protected]'s password: 
The locale requested by LC_CTYPE=pt_BR.UTF-8 isn't available here.
Running `locale-gen pt_BR.UTF-8' may be necessary.

The locale requested by LC_CTYPE=pt_BR.UTF-8 isn't available here.
Running `locale-gen pt_BR.UTF-8' may be necessary.

mosh-server needs a UTF-8 native locale to run.

Unfortunately, the local environment (LC_CTYPE=pt_BR.UTF-8) specifies
the character set "US-ASCII",

The client-supplied environment (LC_CTYPE=pt_BR.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_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE=pt_BR.UTF-8
LC_NUMERIC=pt_BR.UTF-8
LC_TIME=pt_BR.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=pt_BR.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=pt_BR.UTF-8
LC_NAME=pt_BR.UTF-8
LC_ADDRESS=pt_BR.UTF-8
LC_TELEPHONE=pt_BR.UTF-8
LC_MEASUREMENT=pt_BR.UTF-8
LC_IDENTIFICATION=pt_BR.UTF-8
LC_ALL=
Connection to 192.168.0.3 closed.
/usr/bin/mosh: Did not find mosh server startup message. (Have you installed mosh on your server?)

我已经尝试过了

以及许多其他解决方案。

我在客户端上使用 Ubuntu 18.04,在服务器上使用 Raspbian。

答案1

我解决了这个问题使用问题 #916 的这个技巧,登录服务器并运行:

sudo dpkg-reconfigure locales

使用与本地机器相同的语言环境。#793/也应该可以工作。

顺便说一句,你可以清理一下

答案2

请尝试在服务器的 /etc/ssh/sshd_config 中注释掉以下行

####AcceptEnv LANG LC_*

然后运行“/etc/init.d/ssh restart”

我猜测的原因:

我认为您的终端正在将 LANG 和 LC_* 区域设置发送到您的服务器,您的服务器将需要相同区域设置的存在,之后,您的服务器可以使用您刚才设置的语言环境设置。

答案3

在终端(服务器端)上运行此命令帮助我解决了该问题:

locale-gen en_US.UTF-8

相关内容