Display Chinese Characters in Emacs
Usually, if you modify your Emacs config file (i.e., ~/.emacs or ~/.emacs.el) properly, you will be able to display the GB2312 character set, provided that your workstation has at least one Chinese font available. (If you are to check whether the system has provided Chinese fonts or not, try fc-list or xfontsel.)
The following elisp commands will, at least in most cases, enable the display of Chinese characters:
(set-terminal-coding-system 'chinese-iso-8bit)
(set-keyboard-coding-system 'chinese-iso-8bit)
(set-language-environment 'Chinese-GB)
(setq locale-coding-system 'chinese-iso-8bit)
(setq current-language-environment "Chinese-GB")
If your system has fonts that support GBK or GB18030, you may think of using a package called "chinese-gbk" to let Emacs support GBK fonts. If so, instead of setting to language environment to Chinese-GB, you would probably need to set it to Chinese-gbk, by adding the following commands in your .emacs file:
(load "chinese-gbk") ; need to download and install corresponding elisp files
(set-keyboard-coding-system 'chinese-gbk)
(set-selection-coding-system 'chinese-gbk)
(set-keyboard-coding-system 'chinese-gbk)
(set-language-environment 'chinese-gbk)
(setq locale-coding-system 'chinese-gbk)
(setq current-language-environment "Chinese-GBK")
After changing .emacs file, you would need to let Emacs re-evaluate the settings to make it take effect. Either runs the command eval-current-buffer for your .emacs file, or close/kill your current Emacs and then run it again.
Try to open a text file with Chinese characters. If, instead of displaying the Chinese fonts properly, you see a bunch of "boxes", this means either your system does not have an Chinese font available, or your Emacs cannot find a proper fontset to display the characters. Try to specify a useful fontset for your Emacs. For example, in the Linux version of Athena, if SimSun and Ming (a Traditional Chinese font) are available, you can use:
(if (not (member '("-*-tahoma-normal-r-*-*-16-*-*-*-c-*-fontset-chinese"
. "fontset-gbk") fontset-alias-alist))
(progn
(create-fontset-from-fontset-spec
"-*-tahoma-normal-r-*-*-16-*-*-*-c-*-fontset-gbk,
ascii:-*-*-medium-r-normal-*-16-*-*-*-*-*-iso8859-1,
chinese-gb2312:-*-simsun-medium-r-normal-*-16-160-*-*-*-*-gb2312*-*,
korean-ksc5601:-*-medium-r-normal-*-*-*-ksc5601*-*,
chinese-cns11643-5:-*-simsun-medium-r-normal-*-16-160-*-*-*-*-gbk*-0,
chinese-cns11643-6:-*-simsun-medium-r-normal-*-16-160-*-*-*-*-gbk*-0,
chinese-cns11643-7:-*-simsun-medium-r-normal-*-16-160-*-*-*-*-gbk*-0,
chinese-big5-1:-*-Ming(for ISO10646)-*-*-*-*-16-160-*-*-*-*-big5*-*,
chinese-big5-2:-*-Ming(for ISO10646)-*-*-*-*-16-*-*-*-*-*-big5*-*" t)
)
)
(setq default-frame-alist
(append
'((font . "fontset-gbk"))
default-frame-alist))