428
|
1 ;;; japanese.el --- Japanese support -*- coding: iso-2022-7bit; -*-
|
|
2
|
|
3 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
|
|
4 ;; Licensed to the Free Software Foundation.
|
|
5 ;; Copyright (C) 1997 MORIOKA Tomohiko
|
771
|
6 ;; Copyright (C) 2000, 2002 Ben Wing.
|
428
|
7
|
|
8 ;; Keywords: multilingual, Japanese
|
|
9
|
|
10 ;; This file is part of XEmacs.
|
|
11
|
|
12 ;; XEmacs is free software; you can redistribute it and/or modify it
|
|
13 ;; under the terms of the GNU General Public License as published by
|
|
14 ;; the Free Software Foundation; either version 2, or (at your option)
|
|
15 ;; any later version.
|
|
16
|
|
17 ;; XEmacs is distributed in the hope that it will be useful, but
|
|
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
20 ;; General Public License for more details.
|
|
21
|
|
22 ;; You should have received a copy of the GNU General Public License
|
|
23 ;; along with XEmacs; see the file COPYING. If not, write to the Free
|
|
24 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
25 ;; 02111-1307, USA.
|
|
26
|
771
|
27 ;;; Synched up with: Emacs 20.6 (international/japanese.el).
|
|
28
|
428
|
29 ;;; Commentary:
|
|
30
|
|
31 ;; For Japanese, character sets JISX0201, JISX0208, JISX0212 are
|
|
32 ;; supported.
|
|
33
|
|
34 ;;; Code:
|
|
35
|
778
|
36 ; (make-charset 'katakana-jisx0201
|
|
37 ; "Katakana Part of JISX0201.1976"
|
|
38 ; '(dimension
|
|
39 ; 1
|
|
40 ; registry "JISX0201"
|
|
41 ; chars 94
|
|
42 ; columns 1
|
|
43 ; direction l2r
|
|
44 ; final ?I
|
|
45 ; graphic 1
|
|
46 ; short-name "JISX0201 Katakana"
|
|
47 ; long-name "Japanese Katakana (JISX0201.1976)"
|
|
48 ; ))
|
|
49
|
|
50 ; (make-charset 'latin-jisx0201
|
|
51 ; "Roman Part of JISX0201.1976"
|
|
52 ; '(dimension
|
|
53 ; 1
|
|
54 ; registry "JISX0201"
|
|
55 ; chars 94
|
|
56 ; columns 1
|
|
57 ; direction l2r
|
|
58 ; final ?J
|
|
59 ; graphic 0
|
|
60 ; short-name "JISX0201 Roman"
|
|
61 ; long-name "Japanese Roman (JISX0201.1976)"
|
|
62 ; ))
|
|
63
|
|
64 ; (make-charset 'japanese-jisx0208-1978
|
|
65 ; "JISX0208.1978 Japanese Kanji (so called \"old JIS\"): ISO-IR-42"
|
|
66 ; '(dimension
|
|
67 ; 2
|
|
68 ; registry "JISX0208.1990"
|
|
69 ; registry "JISX0208.1978"
|
|
70 ; chars 94
|
|
71 ; columns 2
|
|
72 ; direction l2r
|
|
73 ; final ?@
|
|
74 ; graphic 0
|
|
75 ; short-name "JISX0208.1978"
|
|
76 ; long-name "JISX0208.1978 (Japanese): ISO-IR-42"
|
|
77 ; ))
|
|
78
|
|
79 ; (make-charset 'japanese-jisx0208
|
|
80 ; "JISX0208.1983/1990 Japanese Kanji: ISO-IR-87"
|
|
81 ; '(dimension
|
|
82 ; 2
|
|
83 ; chars 94
|
|
84 ; columns 2
|
|
85 ; direction l2r
|
|
86 ; final ?B
|
|
87 ; graphic 0
|
|
88 ; short-name "JISX0208"
|
|
89 ; long-name "JISX0208.1983/1990 (Japanese): ISO-IR-87"
|
|
90 ; ))
|
|
91
|
|
92 ; (make-charset 'japanese-jisx0212
|
|
93 ; "JISX0212 Japanese supplement: ISO-IR-159"
|
|
94 ; '(dimension
|
|
95 ; 2
|
|
96 ; registry "JISX0212"
|
|
97 ; chars 94
|
|
98 ; columns 2
|
|
99 ; direction l2r
|
|
100 ; final ?D
|
|
101 ; graphic 0
|
|
102 ; short-name "JISX0212"
|
|
103 ; long-name "JISX0212 (Japanese): ISO-IR-159"
|
|
104 ; ))
|
|
105
|
|
106 (make-charset 'japanese-jisx0213-1 "JISX0213 Plane 1 (Japanese)"
|
|
107 '(dimension
|
|
108 2
|
|
109 registry "JISX0213.2000-1"
|
|
110 chars 94
|
|
111 columns 2
|
|
112 direction l2r
|
|
113 final ?O
|
|
114 graphic 0
|
|
115 short-name "JISX0213-1"
|
|
116 long-name "JISX0213-1"
|
|
117 ))
|
|
118
|
|
119 ;; JISX0213 Plane 2
|
|
120 (make-charset 'japanese-jisx0213-2 "JISX0213 Plane 2 (Japanese)"
|
|
121 '(dimension
|
|
122 2
|
|
123 registry "JISX0213.2000-2"
|
|
124 chars 94
|
|
125 columns 2
|
|
126 direction l2r
|
|
127 final ?P
|
|
128 graphic 0
|
|
129 short-name "JISX0213-2"
|
|
130 long-name "JISX0213-2"
|
|
131 ))
|
|
132
|
428
|
133 ;;; Syntax of Japanese characters.
|
|
134 (modify-syntax-entry 'katakana-jisx0201 "w")
|
|
135 (modify-syntax-entry 'japanese-jisx0212 "w")
|
|
136
|
|
137 (modify-syntax-entry 'japanese-jisx0208 "w")
|
|
138 (loop for row in '(33 34 40)
|
|
139 do (modify-syntax-entry `[japanese-jisx0208 ,row] "_"))
|
|
140 (loop for char in '(?$B!<(B ?$B!+(B ?$B!,(B ?$B!3(B ?$B!4(B ?$B!5(B ?$B!6(B ?$B!7(B ?$B!8(B ?$B!9(B ?$B!:(B ?$B!;(B)
|
|
141 do (modify-syntax-entry char "w"))
|
|
142 (modify-syntax-entry ?\$B!J(B "($B!K(B")
|
|
143 (modify-syntax-entry ?\$B!N(B "($B!O(B")
|
|
144 (modify-syntax-entry ?\$B!P(B "($B!Q(B")
|
|
145 (modify-syntax-entry ?\$B!V(B "($B!W(B")
|
|
146 (modify-syntax-entry ?\$B!X(B "($B!Y(B")
|
|
147 (modify-syntax-entry ?\$B!K(B ")$B!J(B")
|
|
148 (modify-syntax-entry ?\$B!O(B ")$B!N(B")
|
|
149 (modify-syntax-entry ?\$B!Q(B ")$B!P(B")
|
|
150 (modify-syntax-entry ?\$B!W(B ")$B!V(B")
|
|
151 (modify-syntax-entry ?\$B!Y(B ")$B!X(B")
|
|
152
|
|
153 ;;; Character categories S, A, H, K, G, Y, and C
|
|
154 (define-category ?S "Japanese 2-byte symbol character.")
|
|
155 (modify-category-entry [japanese-jisx0208 33] ?S)
|
|
156 (modify-category-entry [japanese-jisx0208 34] ?S)
|
|
157 (modify-category-entry [japanese-jisx0208 40] ?S)
|
|
158 (define-category ?A "Japanese 2-byte Alphanumeric character.")
|
|
159 (modify-category-entry [japanese-jisx0208 35] ?A)
|
|
160 (define-category ?H "Japanese 2-byte Hiragana character.")
|
|
161 (modify-category-entry [japanese-jisx0208 36] ?H)
|
|
162 (define-category ?K "Japanese 2-byte Katakana character.")
|
|
163 (modify-category-entry [japanese-jisx0208 37] ?K)
|
|
164 (define-category ?G "Japanese 2-byte Greek character.")
|
|
165 (modify-category-entry [japanese-jisx0208 38] ?G)
|
|
166 (define-category ?Y "Japanese 2-byte Cyrillic character.")
|
|
167 (modify-category-entry [japanese-jisx0208 39] ?Y)
|
|
168 (define-category ?C "Japanese 2-byte Kanji characters.")
|
|
169 (loop for row from 48 to 126
|
|
170 do (modify-category-entry `[japanese-jisx0208 ,row] ?C))
|
|
171 (loop for char in '(?$B!<(B ?$B!+(B ?$B!,(B)
|
|
172 do (modify-category-entry char ?K)
|
|
173 (modify-category-entry char ?H))
|
|
174 (loop for char in '(?$B!3(B ?$B!4(B ?$B!5(B ?$B!6(B ?$B!7(B ?$B!8(B ?$B!9(B ?$B!:(B ?$B!;(B)
|
|
175 do (modify-category-entry char ?C))
|
|
176 (modify-category-entry 'japanese-jisx0212 ?C)
|
|
177
|
|
178 (defvar japanese-word-regexp
|
|
179 "\\cA+\\cH*\\|\\cK+\\cH*\\|\\cC+\\cH*\\|\\cH+\\|\\ck+\\|\\sw+"
|
|
180 "Regular expression used to match a Japanese word.")
|
|
181
|
|
182 (set-word-regexp japanese-word-regexp)
|
|
183 (setq forward-word-regexp "\\w\\>")
|
|
184 (setq backward-word-regexp "\\<\\w")
|
|
185
|
|
186 ;;; Paragraph setting
|
|
187 (setq sentence-end
|
|
188 (concat
|
|
189 "\\("
|
|
190 "\\("
|
|
191 "[.?!][]\"')}]*"
|
|
192 "\\|"
|
|
193 "[$B!%!)!*(B][$B!O!I!G!K!Q!M!S!U!W!Y(B]*"
|
|
194 "\\)"
|
|
195 "\\($\\|\t\\| \\)"
|
|
196 "\\|"
|
|
197 "$B!#(B"
|
|
198 "\\)"
|
|
199 "[ \t\n]*"))
|
1891
|
200
|
|
201 ;; allow paragraphs to start with a zenkaku space
|
|
202 (setq paragraph-start "[ $B!!(B\t\n\f]")
|
|
203 (setq paragraph-separate "[ $B!!(B\t\f]*$")
|
428
|
204
|
|
205 ;; EGG specific setup
|
|
206 (define-egg-environment 'japanese
|
|
207 "Japanese settings for egg."
|
|
208 (lambda ()
|
771
|
209 (with-boundp '(its:*standard-modes* its:*current-map* wnn-server-type)
|
|
210 (with-fboundp 'its:get-mode-map
|
|
211 (when (not (featurep 'egg-jpn))
|
|
212 (load "its-hira")
|
|
213 (load "its-kata")
|
|
214 (load "its-hankaku")
|
|
215 (load "its-zenkaku")
|
|
216 (setq its:*standard-modes*
|
|
217 (append
|
|
218 (list (its:get-mode-map "roma-kana")
|
|
219 (its:get-mode-map "roma-kata")
|
|
220 (its:get-mode-map "downcase")
|
|
221 (its:get-mode-map "upcase")
|
|
222 (its:get-mode-map "zenkaku-downcase")
|
|
223 (its:get-mode-map "zenkaku-upcase"))
|
|
224 its:*standard-modes*))
|
|
225 (provide 'egg-jpn))
|
|
226 (setq wnn-server-type 'jserver)
|
|
227 ;; Can't do this here any more. Must do it when selecting egg-wnn
|
|
228 ;; or egg-sj3
|
|
229 ;; (setq egg-default-startup-file "eggrc-wnn")
|
|
230 (setq-default its:*current-map* (its:get-mode-map "roma-kana"))))))
|
428
|
231
|
450
|
232 ;; stuff for providing grammatic processing of Japanese text
|
428
|
233 ;; something like this should probably be created for all environments...
|
450
|
234 ;; #### Arrgh. This stuff should defvar'd in either fill.el or kinsoku.el.
|
|
235 ;; Then the language environment should set these things, probably buffer-
|
|
236 ;; locally.
|
428
|
237
|
771
|
238 ;; #### will be moved to fill.el
|
|
239 (defvar space-insertable
|
|
240 (let* ((aletter (concat "\\(" ascii-char "\\|" kanji-char "\\)"))
|
|
241 (kanji-space-insertable
|
|
242 (concat
|
428
|
243 "$B!"(B" aletter "\\|"
|
|
244 "$B!#(B" aletter "\\|"
|
|
245 aletter "$B!J(B" "\\|"
|
|
246 "$B!K(B" aletter "\\|"
|
|
247 ascii-alphanumeric kanji-kanji-char "\\|"
|
771
|
248 kanji-kanji-char ascii-alphanumeric)))
|
|
249 (concat " " aletter "\\|" kanji-space-insertable))
|
|
250 "Regexp for finding points that can have spaces inserted into them for justification")
|
428
|
251
|
771
|
252 ;; Beginning of FSF synching with international/japanese.el.
|
|
253
|
428
|
254 ;; (make-coding-system
|
|
255 ;; 'iso-2022-jp 2 ?J
|
|
256 ;; "ISO 2022 based 7bit encoding for Japanese (MIME:ISO-2022-JP)"
|
|
257 ;; '((ascii japanese-jisx0208-1978 japanese-jisx0208
|
|
258 ;; latin-jisx0201 japanese-jisx0212 katakana-jisx0201) nil nil nil
|
|
259 ;; short ascii-eol ascii-cntl seven)
|
|
260 ;; '((safe-charsets ascii japanese-jisx0208-1978 japanese-jisx0208
|
|
261 ;; latin-jisx0201 japanese-jisx0212 katakana-jisx0201)
|
|
262 ;; (mime-charset . iso-2022-jp)))
|
|
263
|
|
264 (make-coding-system
|
|
265 'iso-2022-jp 'iso2022
|
771
|
266 "ISO-2022-JP (Japanese mail)"
|
428
|
267 '(charset-g0 ascii
|
|
268 short t
|
|
269 seven t
|
|
270 input-charset-conversion ((latin-jisx0201 ascii)
|
|
271 (japanese-jisx0208-1978 japanese-jisx0208))
|
|
272 mnemonic "MULE/7bit"
|
771
|
273 documentation
|
|
274 "Coding system used for communication with mail and news in Japan."
|
|
275 ))
|
|
276
|
|
277 (make-coding-system
|
|
278 'jis7 'iso2022
|
|
279 "JIS7 (old Japanese 7-bit encoding)"
|
|
280 '(charset-g0 ascii
|
|
281 charset-g1 katakana-jisx0201
|
|
282 short t
|
|
283 seven t
|
|
284 lock-shift t
|
|
285 input-charset-conversion ((latin-jisx0201 ascii)
|
|
286 (japanese-jisx0208-1978 japanese-jisx0208))
|
|
287 mnemonic "JIS7"
|
|
288 documentation
|
|
289 "Old JIS 7-bit encoding; mostly superseded by ISO-2022-JP.
|
|
290 Uses locking-shift (SI/SO) to select half-width katakana."
|
|
291 ))
|
|
292
|
|
293 (make-coding-system
|
|
294 'jis8 'iso2022
|
|
295 "JIS8 (old Japanese 8-bit encoding)"
|
|
296 '(charset-g0 ascii
|
|
297 charset-g1 katakana-jisx0201
|
|
298 short t
|
|
299 input-charset-conversion ((latin-jisx0201 ascii)
|
|
300 (japanese-jisx0208-1978 japanese-jisx0208))
|
|
301 mnemonic "JIS8"
|
|
302 documentation
|
|
303 "Old JIS 8-bit encoding; mostly superseded by ISO-2022-JP.
|
|
304 Uses high bytes for half-width katakana."
|
428
|
305 ))
|
|
306
|
|
307 (define-coding-system-alias 'junet 'iso-2022-jp)
|
|
308
|
|
309 ;; (make-coding-system
|
|
310 ;; 'iso-2022-jp-2 2 ?J
|
|
311 ;; "ISO 2022 based 7bit encoding for CJK, Latin-1, and Greek (MIME:ISO-2022-JP-2)"
|
|
312 ;; '((ascii japanese-jisx0208-1978 japanese-jisx0208
|
|
313 ;; latin-jisx0201 japanese-jisx0212 katakana-jisx0201
|
|
314 ;; chinese-gb2312 korean-ksc5601) nil
|
|
315 ;; (nil latin-iso8859-1 greek-iso8859-7) nil
|
|
316 ;; short ascii-eol ascii-cntl seven nil single-shift)
|
|
317 ;; '((safe-charsets ascii japanese-jisx0208-1978 japanese-jisx0208
|
|
318 ;; latin-jisx0201 japanese-jisx0212 katakana-jisx0201
|
|
319 ;; chinese-gb2312 korean-ksc5601
|
|
320 ;; latin-iso8859-1 greek-iso8859-7)
|
|
321 ;; (mime-charset . iso-2022-jp-2)))
|
|
322
|
|
323 ;; (make-coding-system
|
|
324 ;; 'japanese-shift-jis 1 ?S
|
|
325 ;; "Shift-JIS 8-bit encoding for Japanese (MIME:SHIFT_JIS)"
|
|
326 ;; nil
|
|
327 ;; '((safe-charsets ascii japanese-jisx0208 japanese-jisx0208-1978
|
|
328 ;; latin-jisx0201 katakana-jisx0201)
|
771
|
329 ;; (mime-charset . shift-jis)
|
428
|
330 ;; (charset-origin-alist (japanese-jisx0208 "SJIS" encode-sjis-char)
|
|
331 ;; (katakana-jisx0201 "SJIS" encode-sjis-char))))
|
|
332
|
|
333 (make-coding-system
|
771
|
334 'shift-jis 'shift-jis
|
|
335 "Shift-JIS"
|
|
336 '(mnemonic "Ja/SJIS"
|
|
337 documentation "The standard Japanese encoding in MS Windows."
|
|
338 ))
|
428
|
339
|
771
|
340 ;; A former name?
|
|
341 (define-coding-system-alias 'shift_jis 'shift-jis)
|
|
342
|
|
343 ;; FSF:
|
|
344 ;; (define-coding-system-alias 'shift-jis 'japanese-shift-jis)
|
428
|
345 ;; (define-coding-system-alias 'sjis 'japanese-shift-jis)
|
|
346
|
|
347 ;; (make-coding-system
|
|
348 ;; 'japanese-iso-7bit-1978-irv 2 ?j
|
|
349 ;; "ISO 2022 based 7-bit encoding for Japanese JISX0208-1978 and JISX0201-Roman"
|
|
350 ;; '((ascii japanese-jisx0208-1978 japanese-jisx0208
|
|
351 ;; latin-jisx0201 japanese-jisx0212 katakana-jisx0201 t) nil nil nil
|
|
352 ;; short ascii-eol ascii-cntl seven nil nil use-roman use-oldjis)
|
|
353 ;; '(ascii japanese-jisx0208-1978 japanese-jisx0208 latin-jisx0201))
|
|
354
|
|
355 (make-coding-system
|
|
356 'iso-2022-jp-1978-irv 'iso2022
|
771
|
357 "ISO-2022-JP-1978-IRV (Old JIS)"
|
428
|
358 '(charset-g0 ascii
|
|
359 short t
|
|
360 seven t
|
|
361 output-charset-conversion ((ascii latin-jisx0201)
|
|
362 (japanese-jisx0208 japanese-jisx0208-1978))
|
771
|
363 documentation
|
|
364 "This is a coding system used for old JIS terminals. It's an ISO
|
|
365 2022 based 7-bit encoding for Japanese JISX0208-1978 and JISX0201-Roman."
|
428
|
366 mnemonic "Ja-78/7bit"
|
|
367 ))
|
|
368
|
771
|
369 ;; FSF:
|
428
|
370 ;; (define-coding-system-alias 'iso-2022-jp-1978-irv 'japanese-iso-7bit-1978-irv)
|
|
371 ;; (define-coding-system-alias 'old-jis 'japanese-iso-7bit-1978-irv)
|
|
372
|
|
373 (define-coding-system-alias 'old-jis 'iso-2022-jp-1978-irv)
|
|
374
|
|
375 ;; (make-coding-system
|
|
376 ;; 'japanese-iso-8bit 2 ?E
|
|
377 ;; "ISO 2022 based EUC encoding for Japanese (MIME:EUC-JP)"
|
|
378 ;; '(ascii japanese-jisx0208 katakana-jisx0201 japanese-jisx0212
|
|
379 ;; short ascii-eol ascii-cntl nil nil single-shift)
|
|
380 ;; '((safe-charsets ascii latin-jisx0201 japanese-jisx0208 japanese-jisx0208-1978
|
771
|
381 ;; katakana-jisx0201 japanese-jisx0212)
|
428
|
382 ;; (mime-charset . euc-jp)))
|
771
|
383 ;;
|
428
|
384 (make-coding-system
|
|
385 'euc-jp 'iso2022
|
771
|
386 "Japanese EUC"
|
428
|
387 '(charset-g0 ascii
|
|
388 charset-g1 japanese-jisx0208
|
|
389 charset-g2 katakana-jisx0201
|
|
390 charset-g3 japanese-jisx0212
|
|
391 short t
|
|
392 mnemonic "Ja/EUC"
|
771
|
393 documentation
|
|
394 "Japanese EUC (Extended Unix Code), the standard Japanese encoding in Unix.
|
|
395 Equivalent MIME encoding: EUC-JP.
|
|
396
|
|
397 Japanese EUC was the forefather of all the different EUC's, which all follow
|
|
398 a similar structure:
|
|
399
|
|
400 1. Up to four character sets can be encoded.
|
|
401
|
|
402 2. This is a non-modal encoding, i.e. it is impossible to set a global state
|
|
403 that affects anything more than the directly following character. [Modal
|
|
404 encodings typically have escape sequences to change global settings, which
|
|
405 affect all the following characters until the setting is turned off.
|
|
406 Modal encodings are typically used when it's necessary to support text in
|
|
407 a wide variety of character sets and still keep basic ASCII compatibility,
|
|
408 or in cases (e.g. sending email) where the allowed characters that can
|
|
409 pass the gateway are small and (typically) no high-bit range is available.
|
|
410
|
|
411 3. The first character set is always ASCII or some national variant of it,
|
|
412 and encoded in the standard ASCII position. All characters in all other
|
|
413 character sets are encoded entirely using high-half bytes. Therefore,
|
|
414 it is safe to scan for ASCII characters, such as '/' to separate path
|
|
415 components, in the obvious way.
|
|
416
|
|
417 4. Each of the other three character sets can be of dimension 1, 2, or 3.
|
|
418 A dimension-1 character set contains 96 bytes; a dimension-2 character
|
|
419 set contains 96 x 96 bytes; and a dimension-3 character set contains
|
|
420 96 x 96 x 96 bytes. 94 instead of 96 as the number of characters per
|
|
421 dimension is also supported. Character sets of dimensions 1, 2, and 3
|
|
422 use 1-3 bytes, respectively, to encode a character, and each byte is
|
|
423 in the range A0-FF (or A1-FE for those with 94 bytes per dimension).
|
|
424
|
|
425 5. The four character sets encoded in EUC are called G0, G1, G2, and G3.
|
|
426 As mentioned earlier, G0 is ASCII or some variant, and encoded into
|
|
427 the ASCII positions 00 - 7F. G1 is encoded directly by laying out
|
|
428 its bytes. G2 is encoded using an 8E byte followed by the character's
|
|
429 bytes. G3 is encoded using an 8F byte followed by the character's bytes."
|
|
430
|
428
|
431 ))
|
|
432
|
771
|
433 ;; FSF:
|
428
|
434 ;; (define-coding-system-alias 'euc-japan-1990 'japanese-iso-8bit)
|
|
435 ;; (define-coding-system-alias 'euc-japan 'japanese-iso-8bit)
|
|
436 ;; (define-coding-system-alias 'euc-jp 'japanese-iso-8bit)
|
|
437
|
|
438 (define-coding-system-alias 'euc-japan 'euc-jp) ; only for w3
|
|
439 (define-coding-system-alias 'japanese-euc 'euc-jp)
|
|
440
|
|
441 (set-language-info-alist
|
|
442 "Japanese" '((setup-function . setup-japanese-environment-internal)
|
|
443 (exit-function . exit-japanese-environment)
|
|
444 (tutorial . "TUTORIAL.ja")
|
|
445 (charset japanese-jisx0208 japanese-jisx0208-1978
|
|
446 japanese-jisx0212 latin-jisx0201 katakana-jisx0201)
|
|
447 (coding-system iso-2022-jp euc-jp
|
771
|
448 shift-jis iso-2022-jp-2)
|
428
|
449 (coding-priority iso-2022-jp euc-jp
|
771
|
450 shift-jis iso-2022-jp-2)
|
|
451 ;; These locale names come from the X11R6 locale.alias file.
|
|
452 ;; What an incredible fucking mess!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
453 ;; What's worse is that typical Unix implementations of
|
|
454 ;; setlocale() return back exactly what you passed them, even
|
|
455 ;; though it's perfectly allowed (and in fact done under
|
|
456 ;; Windows) to expand the locale to its full form (including
|
|
457 ;; encoding), so you have some hint as to the encoding!!!
|
|
458 ;;
|
|
459 ;; We order them in such a way that we're maximally likely
|
|
460 ;; to get an encoding name.
|
|
461 ;;
|
|
462 (locale
|
|
463 ;; SunOS 5.7: ja ja_JP.PCK ja_JP.UTF-8 japanese
|
|
464 ;; RedHat Linux 6.2J: ja ja_JP ja_JP.eucJP ja_JP.ujis \
|
|
465 ;; japanese japanese.euc
|
|
466 ;; HP-UX 10.20: ja_JP.SJIS ja_JP.eucJPput ja_JP.kana8
|
|
467 ;; Cygwin b20.1: ja_JP.EUC
|
|
468 ;; FreeBSD 2.2.8: ja_JP.EUC ja_JP.SJIS
|
|
469
|
|
470 ;; EUC locales
|
|
471 "ja_JP.EUC"
|
|
472 "ja_JP.eucJP"
|
|
473 "ja_JP.AJEC"
|
|
474 "ja_JP.ujis"
|
|
475 "Japanese-EUC"
|
|
476 "japanese.euc"
|
|
477
|
|
478 ;; Shift-JIS locales
|
|
479 "ja_JP.SJIS"
|
|
480 "ja_JP.mscode"
|
|
481 "ja.SJIS"
|
|
482
|
|
483 ;; 7-bit locales
|
|
484 "ja_JP.ISO-2022-JP"
|
|
485 "ja_JP.jis7"
|
|
486 "ja_JP.pjis"
|
|
487 "ja_JP.JIS"
|
|
488 "ja.JIS"
|
|
489
|
|
490 ;; 8-bit locales
|
|
491 "ja_JP.jis8"
|
|
492
|
|
493 ;; encoding-unspecified locales
|
|
494 "ja_JP"
|
|
495 "Ja_JP"
|
|
496 "Jp_JP"
|
|
497 "japanese"
|
|
498 "japan"
|
|
499 "ja"
|
|
500 )
|
|
501
|
|
502 (native-coding-system
|
|
503 ;; first, see if an explicit encoding was given.
|
810
|
504 (lambda (locale)
|
771
|
505 (let ((case-fold-search t))
|
|
506 (cond
|
|
507 ;; many unix versions
|
|
508 ((string-match "\\.euc" locale) 'euc-jp)
|
|
509 ((string-match "\\.sjis" locale) 'shift-jis)
|
|
510
|
|
511 ;; X11R6 (CJKV p. 471)
|
|
512 ((string-match "\\.jis7" locale) 'jis7)
|
|
513 ((string-match "\\.jis8" locale) 'jis8)
|
|
514 ((string-match "\\.mscode" locale) 'shift-jis)
|
|
515 ((string-match "\\.pjis" locale) 'iso-2022-jp)
|
|
516 ((string-match "\\.ujis" locale) 'euc-jp)
|
|
517
|
|
518 ;; other names in X11R6 locale.alias
|
|
519 ((string-match "\\.ajec" locale) 'euc-jp)
|
|
520 ((string-match "-euc" locale) 'euc-jp)
|
|
521 ((string-match "\\.iso-2022-jp" locale) 'iso-2022-jp)
|
|
522 ((string-match "\\.jis" locale) 'jis7) ;; or just jis?
|
|
523 )))
|
|
524
|
|
525 ;; aix (CJKV p. 465)
|
810
|
526 (lambda (locale)
|
771
|
527 (when (eq system-type 'aix)
|
|
528 (cond
|
|
529 ((string-match "^Ja_JP" locale) 'shift-jis)
|
|
530 ((string-match "^ja_JP" locale) 'euc-jp))))
|
|
531
|
|
532 ;; other X11R6 locale.alias
|
810
|
533 (lambda (locale)
|
771
|
534 (cond
|
|
535 ((string-match "^Jp_JP" locale) 'euc-jp)
|
|
536 ((and (eq system-type 'hpux) (eq locale "japanese"))
|
|
537 'shift-jis)))
|
|
538
|
|
539 ;; fallback
|
810
|
540 euc-jp)
|
771
|
541
|
428
|
542 ;; (input-method . "japanese")
|
|
543 (features japan-util)
|
450
|
544 (sample-text . "Japanese ($BF|K\8l(B) $B$3$s$K$A$O(B, (I:]FAJ(B")
|
428
|
545 (documentation . t)))
|
|
546
|
|
547 ;;; japanese.el ends here
|