1 ;;; japanese.el --- support for Japanese -*- coding: iso-2022-7bit; no-byte-compile: t -*-
3 ;; Copyright (C) 1997 Free Software Foundation, Inc.
4 ;; Copyright (C) 1995, 1997, 1998
5 ;; National Institute of Advanced Industrial Science and Technology (AIST)
6 ;; Registration Number H14PRO021
8 ;; National Institute of Advanced Industrial Science and Technology (AIST)
9 ;; Registration Number H13PRO009
11 ;; Keywords: multilingual, Japanese
13 ;; This file is part of GNU Emacs.
15 ;; GNU Emacs is free software; you can redistribute it and/or modify
16 ;; it under the terms of the GNU General Public License as published by
17 ;; the Free Software Foundation; either version 2, or (at your option)
20 ;; GNU Emacs is distributed in the hope that it will be useful,
21 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 ;; GNU General Public License for more details.
25 ;; You should have received a copy of the GNU General Public License
26 ;; along with GNU Emacs; see the file COPYING. If not, write to the
27 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
28 ;; Boston, MA 02110-1301, USA.
32 ;; For Japanese, character sets JISX0201, JISX0208, JISX0212 are
37 ;;; Load translation tables for CP932.
38 (load "international/cp51932")
39 (load "international/eucjp-ms")
41 (define-coding-system 'iso-2022-jp
42 "ISO 2022 based 7bit encoding for Japanese (MIME:ISO-2022-JP)."
43 :coding-type
'iso-2022
45 :designation
[(ascii japanese-jisx0208-1978 japanese-jisx0208
48 :flags
'(short ascii-at-eol ascii-at-cntl
7-bit designation
)
49 :charset-list
'(ascii japanese-jisx0208
50 japanese-jisx0208-1978 latin-jisx0201
)
51 :mime-charset
'iso-2022-jp
)
53 (define-coding-system-alias 'junet
'iso-2022-jp
)
55 (define-coding-system 'iso-2022-jp-2
56 "ISO 2022 based 7bit encoding for CJK, Latin-1, Greek (MIME:ISO-2022-JP-2)."
57 :coding-type
'iso-2022
59 :designation
[(ascii japanese-jisx0208-1978 japanese-jisx0208
60 latin-jisx0201 japanese-jisx0212
61 chinese-gb2312 korean-ksc5601
)
63 (nil latin-iso8859-1 greek-iso8859-7
)
65 :flags
'(short ascii-at-eol ascii-at-cntl
7-bit designation single-shift
67 :charset-list
'(ascii japanese-jisx0208 japanese-jisx0212
68 latin-jisx0201 japanese-jisx0208-1978
69 chinese-gb2312 korean-ksc5601
70 latin-iso8859-1 greek-iso8859-7
)
71 :mime-charset
'iso-2022-jp-2
)
73 (let ((map ; JIS vs CP932
74 '((#x301C .
#xFF5E
) ; WAVE DASH FULLWIDTH TILDE
75 (#x2014 .
#x2015
) ; EM DASH HORIZONTAL BAR
76 (#x2016 .
#x2225
) ; DOUBLE VERTICAL LINE PARALLEL TO
77 (#x2212 .
#xFF0D
) ; MINUS SIGN FULLWIDTH HYPHEN-MINUS
78 (#x00A2 .
#xFFE0
) ; CENT SIGN FULLWIDTH CENT SIGN
79 (#x00A3 .
#xFFE1
) ; POUND SIGN FULLWIDTH POUND SIGN
80 (#x00AC .
#xFFE2
) ; NOT SIGN FULLWIDTH NOT SIGN
81 (#x00A6 .
#xFFE4
) ; BROKEN LINE FULLWIDTH BROKEN LINE
83 (define-translation-table 'japanese-ucs-jis-to-cp932-map map
)
84 (mapc #'(lambda (x) (let ((tmp (car x
)))
85 (setcar x
(cdr x
)) (setcdr x tmp
)))
87 (define-translation-table 'japanese-ucs-cp932-to-jis-map map
))
89 ;; U+2014 (EM DASH) vs U+2015 (HORIZONTAL BAR)
90 (define-translation-table 'japanese-ucs-glibc-to-jis-map
'((#x2015 .
#x2014
)))
91 (define-translation-table 'japanese-ucs-jis-to-glibc-map
'((#x2014 .
#x2015
)))
93 (define-coding-system 'japanese-shift-jis
94 "Shift-JIS 8-bit encoding for Japanese (MIME:SHIFT_JIS)"
95 :coding-type
'shift-jis
97 :charset-list
'(ascii katakana-jisx0201 japanese-jisx0208
)
98 :mime-charset
'shift_jis
)
100 (define-coding-system-alias 'shift_jis
'japanese-shift-jis
)
101 (define-coding-system-alias 'sjis
'japanese-shift-jis
)
102 (define-coding-system-alias 'cp932
'japanese-shift-jis
)
104 (define-coding-system 'japanese-cp932
105 "CP932 (Microsoft shift-jis)"
106 :coding-type
'charset
108 :charset-list
'(ascii katakana-sjis cp932-2-byte
))
110 (define-coding-system-alias 'cp932
'japanese-cp932
)
112 (define-coding-system 'japanese-iso-7bit-1978-irv
113 "ISO 2022 based 7-bit encoding for Japanese JISX0208-1978 and JISX0201-Roman."
114 :coding-type
'iso-2022
116 :designation
[(latin-jisx0201 japanese-jisx0208-1978 japanese-jisx0208
117 japanese-jisx0212 katakana-jisx0201
)
119 :flags
'(short ascii-at-eol ascii-at-cntl
7-bit designation
120 use-roman use-oldjis
)
121 :charset-list
'(ascii latin-jisx0201 japanese-jisx0208-1978 japanese-jisx0208
124 (define-coding-system-alias 'iso-2022-jp-1978-irv
'japanese-iso-7bit-1978-irv
)
125 (define-coding-system-alias 'old-jis
'japanese-iso-7bit-1978-irv
)
127 (define-coding-system 'japanese-iso-8bit
128 "ISO 2022 based EUC encoding for Japanese (MIME:EUC-JP)."
129 :coding-type
'iso-2022
131 :designation
[ascii japanese-jisx0208 katakana-jisx0201 japanese-jisx0212
]
132 :flags
'(short ascii-at-eol ascii-at-cntl single-shift
)
133 :charset-list
'(ascii latin-jisx0201 japanese-jisx0208
134 katakana-jisx0201 japanese-jisx0212
135 japanese-jisx0208-1978
)
136 :mime-charset
'euc-jp
)
138 (define-coding-system-alias 'euc-japan-1990
'japanese-iso-8bit
)
139 (define-coding-system-alias 'euc-japan
'japanese-iso-8bit
)
140 (define-coding-system-alias 'euc-jp
'japanese-iso-8bit
)
142 (define-coding-system 'eucjp-ms
143 "eucJP-ms (like EUC-JP but with CP932 extension).
144 eucJP-ms is defined in <http://www.opengroup.or.jp/jvc/cde/appendix.html>."
145 :coding-type
'iso-2022
147 :designation
[ascii japanese-jisx0208 katakana-jisx0201 japanese-jisx0212
]
148 :flags
'(short ascii-at-eol ascii-at-cntl single-shift
)
149 :charset-list
'(ascii latin-jisx0201 japanese-jisx0208
150 katakana-jisx0201 japanese-jisx0212
)
151 :decode-translation-table
'eucjp-ms-decode
152 :encode-translation-table
'eucjp-ms-encode
)
154 (define-coding-system 'iso-2022-jp-2004
155 "ISO 2022 based 7bit encoding for JIS X 0213:2004 (MIME:ISO-2022-JP-2004)."
156 :coding-type
'iso-2022
158 :designation
[(ascii japanese-jisx0208 japanese-jisx0213.2004-
1
159 japanese-jisx0213-1 japanese-jisx0213-2
)
161 :flags
'(short ascii-at-eol ascii-at-cntl
7-bit designation
)
163 :charset-list
'(ascii japanese-jisx0208 japanese-jisx0213.2004-
1
164 japanese-jisx0213-1 japanese-jisx0213-2
)
165 :mime-charset
'iso-2022-jp-2004
)
167 (define-coding-system-alias 'iso-2022-jp-3
'iso-2022-jp-2004
)
169 (define-coding-system 'euc-jis-2004
170 "ISO 2022 based EUC encoding for JIS X 0213 (MIME:EUC-JIS-2004)."
171 :coding-type
'iso-2022
173 :designation
[ascii japanese-jisx0213.2004-
1 katakana-jisx0201
175 :flags
'(short ascii-at-eol ascii-at-cntl single-shift
)
176 :charset-list
'(ascii latin-jisx0201 japanese-jisx0213.2004-
1
177 japanese-jisx0213-1 katakana-jisx0201
179 :mime-charset
'euc-jis-2004
)
181 (define-coding-system-alias 'euc-jisx0213
'euc-jis-2004
)
183 (define-coding-system 'japanese-shift-jis-2004
184 "Shift_JIS 8-bit encodinf for Japanese (MIME:SHIFT_JIS-2004)"
185 :coding-type
'shift-jis
187 :charset-list
'(ascii katakana-jisx0201
188 japanese-jisx0213.2004-
1 japanese-jisx0213-2
))
190 (define-coding-system-alias 'shift_jis-2004
'japanese-shift-jis-2004
)
192 (set-language-info-alist
193 "Japanese" '((setup-function . setup-japanese-environment-internal
)
194 (tutorial .
"TUTORIAL.ja")
195 (charset japanese-jisx0208
196 japanese-jisx0212 latin-jisx0201 katakana-jisx0201
197 japanese-jisx0213.2004-
1 japanese-jisx0213-1
198 japanese-jisx0213-2 japanese-jisx0208-1978
)
199 (coding-system iso-2022-jp japanese-iso-8bit
200 japanese-shift-jis japanese-iso-7bit-1978-irv
201 iso-2022-jp-2004 japanese-shift-jis-2004
203 (coding-priority iso-2022-jp japanese-iso-8bit
205 iso-2022-jp-2004 euc-jis-2004
206 japanese-shift-jis-2004
208 (input-method .
"japanese")
209 (features japan-util
)
210 (sample-text .
"Japanese (\e$BF|K\8l\e(B) \e$B$3$s$K$A$O\e(B, \e(I:]FAJ\e(B")
211 (documentation . t
)))
214 ;; JISX0213-1 vs Unicode
215 '((#x2477 .
[#x304B
#x309A
])
216 (#x2478 .
[#x304D
#x309A
])
217 (#x2479 .
[#x304F
#x309A
])
218 (#x247a .
[#x3051
#x309A
])
219 (#x247b .
[#x3053
#x309A
])
220 (#x2577 .
[#x30AB
#x309A
])
221 (#x2578 .
[#x30AD
#x309A
])
222 (#x2579 .
[#x30AF
#x309A
])
223 (#x257a .
[#x30B1
#x309A
])
224 (#x257b .
[#x30B3
#x309A
])
225 (#x257c .
[#x30BB
#x309A
])
226 (#x257d .
[#x30C4
#x309A
])
227 (#x257e .
[#x30C8
#x309A
])
228 (#x2678 .
[#x31F7
#x309A
])
229 (#x2b44 .
[#x00E6
#x0300
])
230 (#x2b48 .
[#x0254
#x0300
])
231 (#x2b49 .
[#x0254
#x0301
])
232 (#x2b4a .
[#x028C
#x0300
])
233 (#x2b4b .
[#x028C
#x0301
])
234 (#x2b4c .
[#x0259
#x0300
])
235 (#x2b4d .
[#x0259
#x0301
])
236 (#x2b4e .
[#x025A
#x0300
])
237 (#x2b4f .
[#x025A
#x0301
])
238 (#x2b65 .
[#x02E9
#x02E5
])
239 (#x2b66 .
[#x02E5
#x02E9
])))
242 (setcar elt
(decode-char 'japanese-jisx0213-1
(car elt
))))
243 (setq table
(make-translation-table-from-alist map
))
244 (define-translation-table 'jisx0213-to-unicode table
)
245 (define-translation-table 'unicode-to-jisx0213
246 (char-table-extra-slot table
0)))
250 ;;; arch-tag: 450f5537-9d53-4d5e-b731-4cf116d8cbc9
251 ;;; japanese.el ends here