Holmesian Blog

让Ubuntu支持GBK编码

Ubuntu默认对中文只支持UTF-8编码,可以通过一些修改让Ubuntu支持GBK编码。首先用gedit /var/lib/locales/supported.d/local来修改/var/lib/locales/supported.d/local文件,在文件中添加如下内容:

    zh_CN.UTF-8 UTF-8
    en_US.UTF-8 UTF-8
    zh_CN.GBK GBK
    zh_CN.GB2312 GB2312 

接着用sudo dpkg-reconfigure --force locales强制更新设置:

    root@holmesian-laptop:~/arpoison# gedit /var/lib/locales/supported.d/local
    root@holmesian-laptop:~/arpoison# sudo dpkg-reconfigure --force locales
    Generating locales...
      en_AG.UTF-8... up-to-date
      en_AU.UTF-8... up-to-date
      en_BW.UTF-8... up-to-date
      en_CA.UTF-8... up-to-date
      en_DK.UTF-8... up-to-date
      en_GB.UTF-8... up-to-date
      en_HK.UTF-8... up-to-date
      en_IE.UTF-8... up-to-date
      en_IN.UTF-8... up-to-date
      en_NG.UTF-8... up-to-date
      en_NZ.UTF-8... up-to-date
      en_PH.UTF-8... up-to-date
      en_SG.UTF-8... up-to-date
      en_US.UTF-8... up-to-date
      en_ZA.UTF-8... up-to-date
      en_ZW.UTF-8... up-to-date
      zh_CN.GB2312... done
      zh_CN.GBK... done
      zh_CN.UTF-8... done
      zh_SG.UTF-8... done
    Generation complete.

至此操作完成,Ubuntu能够支持GBK编码了

当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »