部署 ssh 至远程后 终端不能正常显示中文

betterthornbird · November 27, 2014 · Last by luckyyang replied at December 13, 2014 · 3637 hits

在我本机终端是可以的,但是 ssh 过去后就是不行。同事用 windows putty 上去可以。

google 了一会但是没找到合适的答案。也不太容易描述清楚。

Remote Server Loading production environment (Rails 4.1.1) irb(main):001:0> d8-f^G

localserver: ~ better$ 中文

这里 'd8-f^G' 就是输入'中文' 后的显示。

echo $LANG 看看有什么不同

Unknow user #2 November 28, 2014

$ LANG=zh_CN

export LANG=zh_CN 即可。

写到.bashrc 里面:

# 否则无法输入中文
export LANG=zh_CN.UTF-8
export LC_ALL=zh_CN.UTF-8

http://luckyyang.github.io/blog/2014/10/23/ssh-server-with-chinese-locale-issues/ 两行命令: sudo locale-gen zh_CN.UTF-8 sudo dpkg-reconfigure locales

You need to Sign in before reply, if you don't have an account, please Sign up first.