About

In this post I will try to explain how to view and input Chinese charactors in an English linux system(I mean the 'locale' is some kinds of English, i.e., en_US.UTF-8 ). Finnaly, you will be able to view and input Chinese in terminal, vim, gedit, mozilla firefox, thunderbird, OpenOffice.org suites and many other applications while all these applications have the original English interfaces. And if you prefer, you can also switch to Chinese interface with the help of 'locales'.

Why Bother

Some time ago I post an entry about how to enable Chinese Input Method with en_US.UTF-8 local. Suprisingly I got a bunch of referer from Google search recently, most of which are comes from outside of my own country China. So I suppose many of you may be instrest on this issue but it's quite questionable whether the previous blog item could do help while it's written in Chinese. So, I retouch this issue and happily present the solution to all of you, in English.

Before we start

The following statements are based on my Debian GNU/Linux(sid) system. Hopefully it will work for Debian GNU/Linux(test) and generally be applicable to any other distros. And please note that I will narrow Chinese to Simplified Chinese on some aspects because in most cases I just play with Simplified Chinese.

I simply assume that you've configured your system properly which only lacks Chinese support. We'll start at this point, here we go.

Install Chinese fonts

Needless to say, you should install Chinese fonts in order to display and input any Chinese characters.

Currently the following Chinese fonts are available in Debian's package repository:

# for Simplified Chinese
xfonts-intl-chinese    
ttf-arphic-gbsn00lp
ttf-arphic-gkai00mp
# for Traditional Chinese
xfonts-intl-chinese-big
ttf-arphic-bkai00mp
ttf-arphic-bsmi00lp

The first three are for Simplified Chinese and the last three are for Traditional Chinese. Considering you may encounter Traditional Chinese as well as Simplified Chinese and nowadays the disk space is no longer concerned too much, I suggest you install all of them.

Install or reconfigure locales

If you've never installed locales, install it: apt-get install locales. Otherwise, dpkg-reconfigure locales will do.

It will ask what locales you wish to build. Select en_US ISO-8859-1, en_US.UTF-8, zh_CN GB2312(or zh_TW BIG5, for Traditional Chinese) and optional zh_CN.GBK and so forth.

You will also be asked which locale you'd like to set as default. You may choose en_US.UTF-8 but this could be overwritten by user's own setting, i.e., 'export LANG=en_US.UTF-8' in ~/.bashrc.

These selected locales will be generated and the default global locale will be set for your system. Check /etc/environment for default global locale, it may contains a line like 'LANG=en_US.UTF-8'.

install a Chinese Input Method

Before this step, you're able to view Chinese characters in Firefox, view Chinese filename or directory name in gnome-terminal or konsole. Now it's time to install a Chinese Input Method.

There are quite a few Chinese Input Methods out there. The most famous and most popular two, especially for Simplified Chinese users, are SCIM(with its various input modules, including scim-chinese, a Smart Pinyin IMEngine for Simplified Chinese, scim-tables, which contains many table based input methods, and many others.) and Fcitx. Both of them are available from Debian's package repository and are being actively developed.

Personally I choose SCIM and its Smart Pinyin ImEngine for my Chinese Input. As of this writing, 'apt-cache search scim' show me a packages' list related to SCIM:

scim - Smart Common Input Method platform
scim-chinese - Smart Chinese Pinyin input server module for SCIM
scim-config-gconf - GConf Config module for SCIM
scim-config-socket - Socket Config module for SCIM
scim-dev - Smart Common Input Method platform, development files
scim-dev-doc - Smart Common Input Method platform, developer documentation
scim-frontend-socket - Socket FrontEnd module for SCIM
scim-gtk2-immodule - A GTK2 IMModule using SCIM for input backend
scim-server-socket - Socket Server module for SCIM
scim-tables-additional - SCIM Input Method table data for additional languages
scim-tables-ja - SCIM Japanese Input Method table data (Hiragana, Katagana, etc.)
scim-tables-ko - SCIM Korean Input Method table data (Hangul, Hanja, etc.)
scim-tables-zh - SCIM Chinese Input Method table data (WuBi, CangJie, etc.)

I installed the core package scim, scim-chinese to meet my Pinyin input method need and scim-gtk2-immodule to enable SCIM in GTK2 based applications.

Once SCIM and some modules you selected were installed, launch a gnome-terminal, first 'export XMODIFIERS=@im=SCIM', then type 'scim -d' in this terminal. The installed modules will be loaded and scim will started as daemon if everything is good. Now use 'Ctrl+Space' to enable SCIM's IM engine, a status box will be shown somewhere on you screen. Try typing some Pinyins, does it works? If the answer is 'yes', scim is rightly installed.

You may want to make scim start automatically as X starts. Puts the following lines in one of your X initing script:

scim -d    # start scim as daemon
export XMODIFIERS=@im=SCIM
export GTK_IM_MODULE=SCIM        # sets GTK2 IM Module as SCIM

I put them in ~/.xsession, together with another few lines which contains XFce's init command. Thus when I type startx in the console, scim will be started as well as the fabulaous Window Manager - XFce. If you use gdm or kinds of Display Manager, the configuration is analogial.

Need Better Seeing Effect Regards Chinese Characters?

You may have noticed that Chinese characters appears to be obscure. You can improve the situation by adopting some non-free Chinese fonts. Many individual Simplified Chinese linux user employ simsun.ttf from a Microsoft Windows installation for better Chinese characters display.

Currently, a famous hacker from Taiwan, firefly, is working hard to develop some FREE fonts, for both Traditional Chinese and Simplified Chinese. We can expected a better, free solution in the future. Now the fonts is available at study-area and linux.org.tw.

This section is to be updated in the future.

Other issues

Install xpdf-chinese-simplified and/or xpdf-chinese-traditional for pdf files which contain Chinese characters.

Anything else?...

Feedback

Feel free to contact me in any form. I'm hearing your comments, suggestions or questions.