]> code.delx.au - gnu-emacs/blob - lisp/language/chinese.el
*** empty log message ***
[gnu-emacs] / lisp / language / chinese.el
1 ;;; chinese.el --- support for Chinese -*- coding: iso-2022-7bit; -*-
2
3 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
4 ;; Licensed to the Free Software Foundation.
5
6 ;; Keywords: multilingual, Chinese
7
8 ;; This file is part of GNU Emacs.
9
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; any later version.
14
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
19
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
24
25 ;;; Commentary:
26
27 ;; For Chinese, three character sets GB2312, BIG5, and CNS11643 are
28 ;; supported.
29
30 ;;; Code:
31
32 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
33 ;;; Chinese (general)
34 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
35
36 (define-coding-system 'iso-2022-cn
37 "ISO 2022 based 7bit encoding for Chinese GB and CNS (MIME:ISO-2022-CN)."
38 :coding-type 'iso-2022
39 :mnemonic ?C
40 :charset-list '(ascii chinese-gb2312 chinese-cns11643-1 chinese-cns11643-2)
41 :designation [ascii
42 (nil chinese-gb2312 chinese-cns11643-1)
43 (nil chinese-cns11643-2)
44 nil]
45 :flags '(ascii-at-eol ascii-at-cntl 7-bit
46 designation locking-shift single-shift init-at-bol)
47 :mime-charset 'iso-2022-cn)
48
49 (define-coding-system-alias 'chinese-iso-7bit 'iso-2022-cn)
50
51 (define-coding-system 'iso-2022-cn-ext
52 "ISO 2022 based 7bit encoding for Chinese GB and CNS (MIME:ISO-2022-CN-EXT)."
53 :coding-type 'iso-2022
54 :mnemonic ?C
55 :charset-list '(ascii
56 chinese-gb2312 chinese-cns11643-1
57 chinese-cns11643-2 chinese-cns11643-3 chinese-cns11643-4
58 chinese-cns11643-5 chinese-cns11643-6 chinese-cns11643-7)
59 :designation '[ascii
60 (nil chinese-gb2312 chinese-cns11643-1)
61 (nil chinese-cns11643-2)
62 (nil chinese-cns11643-3 chinese-cns11643-4 chinese-cns11643-5
63 chinese-cns11643-6 chinese-cns11643-7)]
64 :flags '(ascii-at-eol ascii-at-cntl 7-bit
65 designation locking-shift single-shift init-at-bol)
66 :mime-charset 'iso-2022-cn-ext)
67
68 \f
69 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
70 ;;; Chinese GB2312 (simplified)
71 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
72
73 (define-coding-system 'chinese-iso-8bit
74 "ISO 2022 based EUC encoding for Chinese GB2312 (MIME:CN-GB)."
75 :coding-type 'iso-2022
76 :mnemonic ?c
77 :charset-list '(ascii chinese-gb2312)
78 :designation [ascii chinese-gb2312 nil nil]
79 :mime-charset 'cn-gb)
80
81 (define-coding-system-alias 'cn-gb-2312 'chinese-iso-8bit)
82 (define-coding-system-alias 'euc-china 'chinese-iso-8bit)
83 (define-coding-system-alias 'euc-cn 'chinese-iso-8bit)
84 (define-coding-system-alias 'cn-gb 'chinese-iso-8bit)
85 (define-coding-system-alias 'gb2312 'chinese-iso-8bit)
86
87 (define-coding-system 'chinese-hz
88 "Hz/ZW 7-bit encoding for Chinese GB2312 (MIME:HZ-GB-2312)."
89 :coding-type 'utf-8
90 :mnemonic ?z
91 :charset-list '(ascii chinese-gb2312)
92 :mime-charset 'hz-gb-2312
93 :post-read-conversion 'post-read-decode-hz
94 :pre-write-conversion 'pre-write-encode-hz)
95
96 (define-coding-system-alias 'hz-gb-2312 'chinese-hz)
97 (define-coding-system-alias 'hz 'chinese-hz)
98
99 (set-language-info-alist
100 "Chinese-GB" '((charset chinese-gb2312 chinese-sisheng)
101 (coding-system chinese-iso-8bit iso-2022-cn chinese-hz)
102 (coding-priority chinese-iso-8bit chinese-big5 iso-2022-cn)
103 (input-method . "chinese-py-punct")
104 (features china-util)
105 (sample-text . "Chinese (\e$AVPND\e(B,\e$AFUM(;0\e(B,\e$A::So\e(B) \e$ADc:C\e(B")
106 (documentation . "Support for Chinese GB2312 character set."))
107 '("Chinese"))
108
109 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
110 ;; Chinese BIG5 (traditional)
111 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
112
113 (define-coding-system 'chinese-big5
114 "BIG5 8-bit encoding for Chinese (MIME:Big5)"
115 :coding-type 'charset
116 :mnemonic ?B
117 :charset-list '(ascii big5)
118 :mime-charset 'big5)
119
120 (define-coding-system-alias 'big5 'chinese-big5)
121 (define-coding-system-alias 'cn-big5 'chinese-big5)
122
123 (set-language-info-alist
124 "Chinese-BIG5" '((charset chinese-big5-1 chinese-big5-2)
125 (coding-system chinese-big5 chinese-iso-7bit)
126 (coding-priority chinese-big5 iso-2022-cn chinese-iso-8bit)
127 (input-method . "chinese-py-punct-b5")
128 (features china-util)
129 (sample-text . "Cantonese (\e$(Gemk#\e(B,\e$(Gl]N)fc\e(B) \e$ATg3?\e(B, \e$ADc:C\e(B")
130 (documentation . "Support for Chinese Big5 character set."))
131 '("Chinese"))
132
133 (define-coding-system 'chinese-big5-hkscs
134 "BIG5-HKSCS 8-bit encoding for Chinese, Hong Kong supplement (MIME:Big5-HKSCS)"
135 :coding-type 'charset
136 :mnemonic ?B
137 :charset-list '(ascii big5-hkscs)
138 :mime-charset 'big5-hkscs)
139 (define-coding-system-alias 'big5-hkscs 'chinese-big5-hkscs)
140 (define-coding-system-alias 'cn-big5-hkscs 'chinese-big5-hkscs)
141
142 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
143 ;; Chinese CNS11643 (traditional)
144 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
145
146 (define-coding-system 'euc-tw
147 "ISO 2022 based EUC encoding for Chinese CNS11643."
148 :coding-type 'iso-2022
149 :mnemonic ?Z
150 :charset-list '(ascii
151 chinese-cns11643-1
152 chinese-cns11643-2
153 chinese-cns11643-3
154 chinese-cns11643-4
155 chinese-cns11643-5
156 chinese-cns11643-6
157 chinese-cns11643-7)
158 :designation [ascii chinese-cns11643-1 (chinese-cns11643-1
159 chinese-cns11643-2
160 chinese-cns11643-3
161 chinese-cns11643-4
162 chinese-cns11643-5
163 chinese-cns11643-6
164 chinese-cns11643-7) nil]
165 :mime-charset 'euc-tw)
166
167 (define-coding-system-alias 'euc-taiwan 'euc-tw)
168
169 (set-language-info-alist
170 "Chinese-CNS" '((charset chinese-cns11643-1 chinese-cns11643-2
171 chinese-cns11643-3 chinese-cns11643-4
172 chinese-cns11643-5 chinese-cns11643-6
173 chinese-cns11643-7)
174 (coding-system iso-2022-cn euc-tw)
175 (coding-priority iso-2022-cn euc-tw chinese-big5
176 chinese-iso-8bit)
177 (features china-util)
178 (input-method . "chinese-cns-quick")
179 ;; Fixme: presumably it won't accept big5 now.
180 (documentation . "\
181 Support for Chinese CNS character sets. Note that EUC-TW coding system
182 accepts Big5 for input also (which is then converted to CNS)."))
183 '("Chinese"))
184
185 ;;; Chinese GBK
186
187 (define-coding-system 'chinese-gbk
188 "GBK encoding for Chinese (MIME:GBK)."
189 :coding-type 'charset
190 :mnemonic ?c
191 :charset-list '(chinese-gbk)
192 :mime-charset 'gbk)
193 (define-coding-system-alias 'gbk 'chinese-gbk)
194 (define-coding-system-alias 'cp936 'chinese-gbk)
195 (define-coding-system-alias 'windows-936 'chinese-gbk)
196
197 (set-language-info-alist
198 "Chinese-GBK" '((charset chinese-gbk)
199 (coding-system chinese-gbk)
200 (coding-priority gbk iso-2022-cn chinese-big5
201 chinese-iso-8bit) ; fixme?
202 (input-method . "chinese-py-punct") ; fixme?
203 (features china-util)
204 (documentation . "Support for Chinese GBK character set."))
205 '("Chinese"))
206
207 ;;; Chinese GB18030
208
209 (define-coding-system 'chinese-gb18030
210 "GB18030 encoding for Chinese (MIME:GB18030)."
211 :coding-type 'charset
212 :mnemonic ?c
213 :charset-list '(gb18030)
214 :mime-charset 'gb18030
215 )
216 (define-coding-system-alias 'gb18030 'chinese-gb18030)
217
218 (set-language-info-alist
219 "Chinese-GB18030" '((charset gb18030)
220 (coding-system chinese-gb18030)
221 (coding-priority gb18030 gbk iso-2022-cn chinese-big5
222 chinese-iso-8bit) ; fixme?
223 (input-method . "chinese-py-punct") ; fixme?
224 (features china-util)
225 (documentation
226 . "Support for Chinese GB18030 character set."))
227 '("Chinese"))
228
229 ;; Fixme: add HKSCS
230
231 (provide 'chinese)
232
233 ;;; chinese.el ends here