歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> Mint(Ubuntu)Linux終端中文顯示亂碼問題的解決

Mint(Ubuntu)Linux終端中文顯示亂碼問題的解決

日期:2017/3/1 14:05:26   编辑:關於Linux
Mint(Ubuntu)Linux終端中文顯示亂碼問題的解決 0、安裝zhcon 1 sudo apt-get install zhcon 解決方法: 一. Ubuntu默認的中文字符編碼 Ubuntu默認的中文字符編碼為zh_CN.UTF-8,這個可以在/etc/environment中看到: sudo gedit /etc/environment 可以看到如下內容: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games" LANG="zh_CN.UTF-8" LANGUAGE="zh_CN:zh:en_US:en" 第二行即是默認的中文字符編碼。注:可以通過這裡修改默認的中文編碼字符,比如修改為:zh_CN.GBK。 二. 添加中文字符編碼的方法 1. 直接使用locale-gen 在終端輸入命令: sudo locale-gen zh_CN.GB18030 即可完成中文字符集的添加。完成後可以轉到 /usr/lib/locale/,下面已經有一個zh_CN.gb18030文件夾;在超級終端輸入命令: gedit /var/lib/locales/supported.d/local,可以發現文件中多了一行:zh_CN.GB18030 GB18030。說明添加成功。 2. 通過修改/var/lib/locales/supported.d/local文件 在終端輸入命令行 sudo gedit /var/lib/locales/supported.d/local 可以看到如下內容: 1 zh_CN.UTF-8 UTF-8 2 en_US.UTF-8 UTF-8 在文件尾添加中文字符集 1 zh_CN.GBK GBK 保存後退出。在終端輸入命令: 1 sudo dpkg-reconfigure locales Generating locales... en_AU.UTF-8... done en_BW.UTF-8... done en_CA.UTF-8... done en_DK.UTF-8... done en_GB.UTF-8... done en_HK.UTF-8... done en_IE.UTF-8... done en_IN.UTF-8... done en_NZ.UTF-8... done en_PH.UTF-8... done en_SG.UTF-8... done en_US.UTF-8... done en_ZA.UTF-8... done en_ZW.UTF-8... done zh_CN.GBK... done zh_CN.UTF-8... up-to-date zh_HK.UTF-8... done zh_SG.UTF-8... done zh_TW.UTF-8... done Generation complete. 即可生成相應文件:/usr/lib/locale/zh_CN.gbk/ 最後重啟ubuntu。
Copyright © Linux教程網 All Rights Reserved