Ben Chuanlong Du's Blog

It is never too late to learn.

Chinese Locale in Linux

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

First you have to make sure locales is installed. If not, you can install it using the following command (on Ubuntu/Debian).

sudo apt-get install locales

Ubuntu

# GB2312 encoding support
sudo locale-gen zh_CN
# UTF-8 encoding support
sudo locale-gen zh_CN.UTF-8

$LANG environment control the different language to use ...

Debian

Notice that locale-gen is one of those things that Ubuntu differs from Debian. While locale-gen in Ubuntu takes arguments from command-line, locale-gen in Debain read locales from the file /etc/locale.gen. You can follow the steps below to generate locales in Debian.

  1. Uncomment locales to generate in the file /etc/locale.gen.

  2. Run the command sudo locale-gen.

References

Comments