在 windows 系统下,.txt 文件默认编码方式为 gb18030 格式的中文编码,而 gedit 默认的编码方式为 UTF-8java
在缺省配置下,用 Ubuntu 的文本编辑器(gedit)打开GB18030(繁体中文用户请将这里的出现的GB18030替换成BIG5或BIG5-HKSCS)类型的中文编码文本文件时,将会出现乱码。(中文简体和繁体都显示乱码时,则将GB18030,BIG5,BIG5-HKSCS都加上)
ubuntu
gedit --version
// 中文乱码(‘GB18030‘,‘GB2312‘,‘GBK‘中文简体字符集,‘BIG5‘,’BIG5-HKSCS' 中文繁体字符集) gsettings set org.gnome.gedit.preferences.encodings candidate-encodings "['GB18030', 'UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16']"
step 1: 安装 dconf-editorwindows
sudo apt install dconf-editor // 在终端中输入,安装 dconf-editor
step 2: 运行 dconf-editor
在终端中输入dconf-editor
,打开econf-editorapp
step 3: 展开 org/gnome/gedit/preferences/encodings编辑器
step 4: 把 "candidate-encodings" 的值更改成 [‘GB18030’, ‘UTF-8’, ‘CURRENT’, ‘ISO-8859-15’, ‘UTF-16’]
编码
// 中文乱码(‘GB18030‘,‘GB2312‘,‘GBK‘中文简体字符集,‘BIG5‘,’BIG5-HKSCS' 中文繁体字符集) gconftool-2 --set --type=list --list-type=string /apps/gedit-2/preferences/encodings/auto_detected "[GB18030,UTF-8,CURRENT,ISO-8859-15,UTF-16]"
step 1: 安装 dconf-editorcode
sudo apt install dconf-editor // 在终端中输入,安装 dconf-editor
step 2: 运行 dconf-editor
在终端中输入dconf-editor
,打开econf-editorblog
step 3: 展开 /apps/gedit-2/preferences/encodingsstring
step 4: 在auto_detected键中新增GB18030,并使它位于UTF-8前面,肯定。it