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