Ubuntu命令行shell显示中文异常

系统字体配置、中文显示和输入法问题
liuzhaoyzz
帖子: 9
注册时间: 2021-02-01 20:13
系统: WIN10

Ubuntu命令行shell显示中文异常

#1

帖子 liuzhaoyzz » 2022-10-25 21:31

Ubuntu命令行shell显示中文
Ubuntu命令行shell显示中文-iibull-ChinaUnix博客 http://blog.chinaunix.net/uid-27875-id-5860203.html
我按照上面的教程,设置了下,结果ubuntu shell显示中文还是乱码,请问下该怎么办?我没有安装Xwinodw
sudo nano /etc/apt/sources.list
Ubuntu64 位-2022-10-25-21-29-00.png
上次由 liuzhaoyzz 在 2022-10-26 23:00,总共编辑 1 次。
头像
astolia
论坛版主
帖子: 6454
注册时间: 2008-09-18 13:11

Re: Ubuntu命令行shell显示中文异常

#2

帖子 astolia » 2022-10-26 9:32

你的运行环境到底是什么?实机安装?虚拟机安装?ssh远程连接?wsl?wsl2?
你的图也没传上来,去读一下置顶帖
头像
daf3707
论坛版主
帖子: 12731
注册时间: 2007-06-13 15:57
来自: 在他乡

Re: Ubuntu命令行shell显示中文异常

#3

帖子 daf3707 » 2022-10-26 9:51

是不是要在tty下显示中文,可以搜索 fbterm,比如这里
https://fooyou.github.io/document/2015/ ... n-tty.html
liuzhaoyzz
帖子: 9
注册时间: 2021-02-01 20:13
系统: WIN10

Re: Ubuntu命令行shell显示中文异常

#4

帖子 liuzhaoyzz » 2022-10-26 17:38

astolia 写了: 2022-10-26 9:32 你的运行环境到底是什么?实机安装?虚拟机安装?ssh远程连接?wsl?wsl2?
你的图也没传上来,去读一下置顶帖
我是在虚拟机安装的ubuntu22,不是WSL WSL2,ssh远程连接可以正常显示中文,但是在虚拟机中不能显示中文。
我的图我上传了,很奇怪为啥看不到。
liuzhaoyzz
帖子: 9
注册时间: 2021-02-01 20:13
系统: WIN10

Re: Ubuntu命令行shell显示中文异常

#5

帖子 liuzhaoyzz » 2022-10-26 17:41

daf3707 写了: 2022-10-26 9:51 是不是要在tty下显示中文,可以搜索 fbterm,比如这里
https://fooyou.github.io/document/2015/ ... n-tty.html
你这个帖子,好像说的是在桌面下的显示?我现在没有安装xwindow,可能不一样吧?

晚点我上传乱码的截图。
Ubuntu64 位-2022-10-25-21-29-00.png
头像
daf3707
论坛版主
帖子: 12731
注册时间: 2007-06-13 15:57
来自: 在他乡

Re: Ubuntu命令行shell显示中文异常

#6

帖子 daf3707 » 2022-10-27 10:44

不是桌面下,是tty终端显示及输入中文,你再看看帖子
liuzhaoyzz
帖子: 9
注册时间: 2021-02-01 20:13
系统: WIN10

Re: Ubuntu命令行shell显示中文异常

#7

帖子 liuzhaoyzz » 2022-10-27 11:15

daf3707 写了: 2022-10-27 10:44 不是桌面下,是tty终端显示及输入中文,你再看看帖子
您说的这个fbterm,我在VPS里面的ubuntu上面试了下,好像是基于xwindow的啊?
作为tty下面中文显示方案,这个fbterm感觉太重了,依赖库暴多。

Configuration file '/etc/cloud/cloud.cfg'
我不知道怎么配置,取了默认值。

sudo chmod u+s /usr/bin/fbterm
chmod: cannot access '/usr/bin/fbterm': No such file or directory
失败了。

sudo setcap 'cap_sys_tty_config+ep' /usr/bin/fbterm
Failed to set capabilities on file `/usr/bin/fbterm' (No such file or directory)
The value of the capability argument is not permitted for a file. Or the file is not a regular (non-symlink) file
失败了。

fcitx-fbterm-helper
Your display number is localhost10
Test whether fcitx is running correctly with dbus...
Cannot communicate fcitx with DBus.

=========================================================
=========================================================
Fcitx is not running, you may setup it mannually
The easiest way is set $DISPLAY, start fcitx from X
Then try this helper
=========================================================
你看上面最后的提示,还是提示需要依赖于xwindow,dbus这些。
附件
fbterm安装日志.txt
(315.42 KiB) 已下载 42 次
头像
qy117121
论坛版主
帖子: 50546
注册时间: 2007-12-14 13:40
系统: Winbuntu
来自: 志虚国乌由市
联系:

Re: Ubuntu命令行shell显示中文异常

#8

帖子 qy117121 » 2022-10-27 13:28

你是vps ssh连接要显示中文吗?

代码: 全选

sudo apt install -y language-pack-zh-hans
编辑/etc/default/locale 修改语言为中文

代码: 全选

LANG="zh_CN.UTF-8"
LANGUAGE="zh_CN:zh"
重启
渠月 · QY   
本人只会灌水,不负责回答问题
无聊可以点一下→ http://u.nu/ubuntu

Ubuntu 20.04 快速设置指南,请配合浏浏览器自动翻译使用

邮箱 chuan@ubuntu.org.cn
liuzhaoyzz
帖子: 9
注册时间: 2021-02-01 20:13
系统: WIN10

Re: Ubuntu命令行shell显示中文异常

#9

帖子 liuzhaoyzz » 2022-10-27 13:48

qy117121 写了: 2022-10-27 13:28 你是vps ssh连接要显示中文吗?

代码: 全选

sudo apt install -y language-pack-zh-hans
编辑/etc/default/locale 修改语言为中文

代码: 全选

LANG="zh_CN.UTF-8"
LANGUAGE="zh_CN:zh"
重启

你说的这些,我在一楼的帖子超链接里面已经贴出来了啊。我就是这样子做的。

如果通过ssh连接上ubuntu(包括vmware虚拟机里面的ubuntu或者是VPS里面的ubunt),mobaxterm客户端都可以正常地显示中文。
我现在是在vmware虚拟机里面的ubuntu,某些环境显示中文正常,比如执行
su root
系统会提示:“请输入输入密码”,这个正常显示中文。
但是sudo nano /etc/apt/sources.list这样子的时候,nano里面,最下面显示的是乱码,不是英文。
还有sakufrp安装后,在vmware虚拟机里面的ubuntu显示的也是乱码,不是中文,但是通过mobaxterm客户端-ssh就可以正常显示中文。
我不知道这是怎么回事。
头像
qy117121
论坛版主
帖子: 50546
注册时间: 2007-12-14 13:40
系统: Winbuntu
来自: 志虚国乌由市
联系:

Re: Ubuntu命令行shell显示中文异常

#10

帖子 qy117121 » 2022-10-27 16:03

你一会VPS一会又tty

首先tty 不支持中文,要在TTY显示中文一般就是用fbterm
你7楼的内容,是没有安装fbterm就执行了那些命令?
tty下一般也不需要输入中文,如果需要也可以设置输入法,
安装fbterm,并运行一次,以生成~/.fbtermrc文件
编辑~/.fbtermrc文件
改字体、字号、输入法、编码

代码: 全选

font-names=DejaVu Sans YuanTi Mono
font-size=15
input-method=yong
text-encodings=utf8
最后

代码: 全选

 sudo chmod u+s /usr/bin/fbterm 
viewtopic.php?p=2489939#p2489939
渠月 · QY   
本人只会灌水,不负责回答问题
无聊可以点一下→ http://u.nu/ubuntu

Ubuntu 20.04 快速设置指南,请配合浏浏览器自动翻译使用

邮箱 chuan@ubuntu.org.cn
liuzhaoyzz
帖子: 9
注册时间: 2021-02-01 20:13
系统: WIN10

Re: Ubuntu命令行shell显示中文异常

#11

帖子 liuzhaoyzz » 2022-10-27 16:16

qy117121 写了: 2022-10-27 16:03 你一会VPS一会又tty

首先tty 不支持中文,要在TTY显示中文一般就是用fbterm
你7楼的内容,是没有安装fbterm就执行了那些命令?
tty下一般也不需要输入中文,如果需要也可以设置输入法,
安装fbterm,并运行一次,以生成~/.fbtermrc文件
编辑~/.fbtermrc文件
改字体、字号、输入法、编码

代码: 全选

font-names=DejaVu Sans YuanTi Mono
font-size=15
input-method=yong
text-encodings=utf8
最后

代码: 全选

 sudo chmod u+s /usr/bin/fbterm 
viewtopic.php?p=2489939#p2489939
我在7楼的帖子,先安装了fbterm了呀,附件里面不是有完整的操作记录吗?我是通过ssh连接到VPS服务器操作的,VPS里面的ubuntu没有安装xindow。
我都是按照那个帖子教程逐步做的。https://fooyou.github.io/document/2015/ ... n-tty.html
过程中出现了两个错误提示,我粘贴到7楼了。

你说的:
编辑~/.fbtermrc文件
改字体、字号、输入法、编码
font-names=DejaVu Sans YuanTi Mono
font-size=15
input-method=yong
text-encodings=utf8
最后
sudo chmod u+s /usr/bin/fbterm

这个我做过的。
头像
qy117121
论坛版主
帖子: 50546
注册时间: 2007-12-14 13:40
系统: Winbuntu
来自: 志虚国乌由市
联系:

Re: Ubuntu命令行shell显示中文异常

#12

帖子 qy117121 » 2022-10-27 16:22

sudo chmod u+s /usr/bin/fbterm
chmod: cannot access '/usr/bin/fbterm': No such file or directory
你确定你安装了fbterm ?
渠月 · QY   
本人只会灌水,不负责回答问题
无聊可以点一下→ http://u.nu/ubuntu

Ubuntu 20.04 快速设置指南,请配合浏浏览器自动翻译使用

邮箱 chuan@ubuntu.org.cn
头像
qy117121
论坛版主
帖子: 50546
注册时间: 2007-12-14 13:40
系统: Winbuntu
来自: 志虚国乌由市
联系:

Re: Ubuntu命令行shell显示中文异常

#13

帖子 qy117121 » 2022-10-27 16:25

[ubuntu@VM-8-16-ubuntu ~]$ sudo apt-get install fbterm fcitx fcitx-fbterm fcitx-chewing fcitx-configtool
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package fcitx-fbterm
E: Unable to locate package fcitx-configtool

[ubuntu@VM-8-16-ubuntu ~]$ sudo apt-get update

因为没有找到 fcitx-fbterm 和 fcitx-configtool 所以你的安装命令并没有成功运行
渠月 · QY   
本人只会灌水,不负责回答问题
无聊可以点一下→ http://u.nu/ubuntu

Ubuntu 20.04 快速设置指南,请配合浏浏览器自动翻译使用

邮箱 chuan@ubuntu.org.cn
liuzhaoyzz
帖子: 9
注册时间: 2021-02-01 20:13
系统: WIN10

Re: Ubuntu命令行shell显示中文异常

#14

帖子 liuzhaoyzz » 2022-10-27 17:03

qy117121 写了: 2022-10-27 16:25
[ubuntu@VM-8-16-ubuntu ~]$ sudo apt-get install fbterm fcitx fcitx-fbterm fcitx-chewing fcitx-configtool
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package fcitx-fbterm
E: Unable to locate package fcitx-configtool

[ubuntu@VM-8-16-ubuntu ~]$ sudo apt-get update

因为没有找到 fcitx-fbterm 和 fcitx-configtool 所以你的安装命令并没有成功运行
确实是这两个包没有安装上去,所以我
sudo apt-get update
sudo apt-get upgrade

然后sudo apt-get install fbterm fcitx fcitx-fbterm fcitx-chewing fcitx-configtool
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package fcitx-fbterm
E: Unable to locate package fcitx-configtool
这两个包还是没有安装上去。

我看了下你前面贴的帖子,2010年的,
wget -c http://fbterm.googlecode.com/files/fbterm-1.7.0.tar.gz
tar -xzf fbterm-1.7.0.tar.gz
cd fbterm-1.7
./configure --prefix=/usr
make
sudo make install
似乎是要下载并编译,谷歌要翻墙啊。。。

https://www.cnblogs.com/itfat/p/16009251.html
我在网上找了个地址https://www.cnblogs.com/itfat/p/16009251.html

待编辑......
头像
qy117121
论坛版主
帖子: 50546
注册时间: 2007-12-14 13:40
系统: Winbuntu
来自: 志虚国乌由市
联系:

Re: Ubuntu命令行shell显示中文异常

#15

帖子 qy117121 » 2022-10-27 17:12

你可以只安装fmterm 然后配置字体,使显示正常,中文输入可以后面再装

fcitx的是输入法,不影响fbterm的显示
渠月 · QY   
本人只会灌水,不负责回答问题
无聊可以点一下→ http://u.nu/ubuntu

Ubuntu 20.04 快速设置指南,请配合浏浏览器自动翻译使用

邮箱 chuan@ubuntu.org.cn
回复