解决ubuntu终端无法输入中文的问题

时间:2021-01-31 02:47:53
解决ubuntu终端无法输入中文的问题

来源: https://my.oschina.net/lvhongqing/blog/851922

首先把中文语言包安装上

打开 /var/lib/locales/supported.d/local
添加zh_CN.GB2312字符集,如下:
en_US.UTF-8 UTF-8
zh_CN.UTF-8 UTF-8
zh_CN.GBK GBK
zh_CN GB2312
保存后,执行命令:
sudo locale-gen

locale-gen en_US.UTF-8
vim  /etc/locale.gen
en_US.UTF-8 UTF-8
en_US ISO-8859-1

vim /etc/default/locale
vim /etc/environment
LANG="zh_CN.UTF-8"
LANGUAGE="zh_CN:zh:en_US:en"
LC_ALL="zh_CN.UTF-8"

vim /etc/profile 开头
LANG="zh_CN.UTF-8"

vim ~/.bashrc (不要加 sudo)
複製下述這三行 貼在最後面
export LANG=LANG="zh_CN.utf-8"
export LANGUAGE="zh_CN:zh:en_US:en"
export LC_ALL="zh_CN.utf-8"

vim ~/.inputrc
set meta-flag on
set convert-meta off
set input-meta on
set output-meta on