文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>UBuntu中增加中文字符编码的方法

UBuntu中增加中文字符编码的方法

时间:2010-09-27  来源:He,YuanHui

在Widnows XP下的FTP服务器中有中文文件名 ,今天使用ftp命令,发现不能显示中文文件名,只能显示????。于是到网上查了一些资料,也没有找到好的解决方法,只是有人说使用图形化的ftp工具gftp,安装方法:sudo apt-get install gftp,另外还要增加中文字符编码zh_CN.GBK即可即可。在这里总结一下Ubuntu下增加中文字符编码的方法。
一. 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
可以看到如下内容:

zh_CN.UTF-8 UTF-8
en_US.UTF-8 UTF-8

在文件尾添加中文字符集
zh_CN.GBK GBK
保存后退出。在超级终端输入命令:
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/
注:也可使用locale-gen

 

作者:denlee   发布时间:2008-4-1

 

 

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载