在 Debian 上使用 SecureCRT 连接服务器出现中文乱码,通常是字符编码不一致或字体不支持中文导致的。可以按下面步骤逐一排查和解决:
先在 Debian 服务器上执行:
locale
echo "中文测试"
如果服务器本身就乱码,先解决服务器 locale:
sudo dpkg-reconfigure locales
# 至少选 zh_CN.UTF-8 或 en_US.UTF-8
并确认:
export LANG=zh_CN.UTF-8
export LC_ALL=zh_CN.UTF-8
Terminal → Appearance → Character encoding
❌ 不要选 GBK / GB2312(除非服务器明确用 GBK)
仍在:
Session Options → Terminal → Appearance → Font
选择支持中文的字体,例如:
在 SecureCRT 中:
Session Options → Connection → Terminal
确保:
linux 或 xtermGlobal Options → Terminal → Appearance
也统一设为 UTF-8
| 现象 | 原因 |
|---|---|
| 显示方块 | 字体不支持中文 |
| 显示问号 | 编码不是 UTF-8 |
| 本地正常远程乱码 | 服务器 locale 不对 |
| vi 中文乱码 | 编辑器和终端编码不一致 |
如果你愿意,可以告诉我:
我可以给你更精确的配置截图级指导。