1. 程式人生 > >Mac ssh ubuntu linux 等系統時中文亂碼

Mac ssh ubuntu linux 等系統時中文亂碼

如題,mac裡面終端明明已經用了utf-8卻在ssh時發生亂碼,只要在ssh伺服器端設定一下即可,非常簡單。

在Linux系統中,找到使用者目錄下的.bashrc檔案
cd ~
vi .bashrc #這個檔名有的系統可能不全是這樣的,比如.bash_xxx都是有可能的,開啟看下,如果裡面都是些環境變數配置基本上就可以斷定了。
####比如我這個顯示的是這樣的
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples # If not running interactively, don't do anything case $- in *i*) ;; *) return;; esac # don't put duplicate lines or lines starting with space in the history. # See bash(1) for more options ####。。。。。 在這個檔案最後加一行:export LC_CTYPE=en_US.UTF-8 然後退出vi,source ~/.bashrc 就可以了,重連ssh就能正常顯示了。