在 Debian 上使用 SecureCRT 出现中文乱码,通常是字符编码不一致或字体不支持中文导致的。可按下面步骤逐一排查和解决。
Options → Session Options → Terminal → Appearance
UTF-8File → Connect → 右键会话 → Properties → Terminal → Appearance
同样设为 UTF-8✅ 这是解决乱码最关键的一步
在:
Session Options → Terminal → Emulation
Linux 或 xtermUse color schemeLine mode 视情况Session Options → Terminal → Appearance → Font
推荐字体:
DejaVu Sans MonoNoto Sans Mono CJKWenQuanYi Zen Hei(文泉驿)⚠️ 不要使用纯英文点阵字体
locale
正常应为:
LANG=zh_CN.UTF-8
LC_ALL=zh_CN.UTF-8
sudo dpkg-reconfigure locales
zh_CN.UTF-8或临时:
export LANG=zh_CN.UTF-8
export LC_ALL=zh_CN.UTF-8
编辑:
sudo vim /etc/ssh/sshd_config
确保没有:
AcceptEnv LANG LC_*
被注释掉
重启:
sudo systemctl restart ssh
| 现象 | 原因 |
|---|---|
中文变 ?? |
编码不是 UTF-8 |
| 中文方块 | 字体不支持中文 |
| 登录后乱码,命令行正常 | 远程 shell 编码问题 |
| vi 里乱码 | vim 编码未设 UTF-8 |
vim 配置示例:
set encoding=utf-8
set fileencoding=utf-8
SecureCRT 用 UTF-8 + 中文字体,Debian 用 UTF-8 locale,基本就能解决 99% 乱码问题。
如果你愿意,可以告诉我:
我可以更精确地帮你定位。