MacOS终端状态下,使用ssh远程连接服务器时,服务端会发出如下警告:
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US:en",
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
终端内有关中文的输出则都会无法正常显示。
解决方案
修改客户端SSH配置文件:
(OS High Sierra / Linux) sudo vi /etc/ssh/ssh_config
在文件中注释(#)下面配置:
SendEnv LANG LC_*
重新打开终端进行ssh连接,问题解决。
References
https://www.yangrunwei.com/a/74.html
https://www.cyberciti.biz/faq/os-x-terminal-bash-warning-setlocale-lc_ctype-cannot-change-locale/