linux tty终端中文,Linux的TTY不能显示中文

最近想解决Linux(CentOS8)在TTY下显示中文的问题,最后发现是徒劳,TTY本来就不能显示中文等Unicode字符。

在CentOS8中安装中文包:sudo dnf install langpack-zh_CN

CentOS8开始使用dnf工具。

临时修改Terminal的语言为中文:

$ LANG="zh_CN.UTF-8"

这个修改是临时的,logout后或者是别的Terminal,都无效。

在TTY下,无法显示中文:

2bc6b0c4465488c6797039b6a36e6b36.png

TTY不能显示中文

中文部分全部都显示为小方块。

用别的Terminal登录,就可以正常显示中文:

[xinlin@localhost gps]$ weasdfasdfa

-bash: weasdfasdfa: command not found

[xinlin@localhost gps]$ echo $LANG

en_US.UTF-8

[xinlin@localhost gps]$ LANG="zh_CN.UTF-8"

[xinlin@localhost gps]$ echo $LANG

zh_CN.UTF-8

[xinlin@localhost gps]$ awerqwerwer

-bash: awerqwerwer: 未找到命令

网络上有人解释过这个问题:

明确的和你说,TTY 不支持中文!

Linux kernel maintainers do not accept patches for better Unicode support on the console because the console is to be used as an emergency interface. What needs to be done is write a terminal emulator for the Linux framebuffer that undertakes the support for Unicode. Something like a 'getty' replacement. This aspect of open-source development did not receive yet much attention

大意是:linux核心机制不接受任何的unicode补丁在Console层面,因为Console是作为一种紧急接口被使用...... 而且目前开源开发组也没有过多的关注这一点.

从这里可以得出一个结论,目前tty是给管理员紧急修复系统时所使用的界面,故而从内核层面就不支持加载unicode包;但是模拟接口比如用SSH之类的登陆,是可以支持中文的!

看来一般工作时,Linux还是要配合一个Terminal才行!

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值