Add map #x00A6 <-> #xFFE4 to translation tables japanese-ucs-*-map.
[bpt/emacs.git] / lisp / language / japanese.el
1 ;;; japanese.el --- support for Japanese -*- coding: iso-2022-7bit; no-byte-compile: t -*-
2
3 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
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
8
9 ;; Keywords: multilingual, Japanese
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
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.
27
28 ;;; Commentary:
29
30 ;; For Japanese, character sets JISX0201, JISX0208, JISX0212 are
31 ;; supported.
32
33 ;;; Code:
34
35 ;;; Load translation tables for CP932.
36 (load "international/cp51932")
37 (load "international/eucjp-ms")
38
39 (define-coding-system 'iso-2022-jp
40 "ISO 2022 based 7bit encoding for Japanese (MIME:ISO-2022-JP)."
41 :coding-type 'iso-2022
42 :mnemonic ?J
43 :designation [(ascii japanese-jisx0208-1978 japanese-jisx0208
44 latin-jisx0201 japanese-jisx0212)
45 nil nil nil]
46 :flags '(short ascii-at-eol ascii-at-cntl 7-bit designation)
47 :charset-list '(ascii japanese-jisx0208 japanese-jisx0212
48 japanese-jisx0208-1978 latin-jisx0201)
49 :mime-charset 'iso-2022-jp)
50
51 (define-coding-system-alias 'junet 'iso-2022-jp)
52
53 (define-coding-system 'iso-2022-jp-2
54 "ISO 2022 based 7bit encoding for CJK, Latin-1, Greek (MIME:ISO-2022-JP-2)."
55 :coding-type 'iso-2022
56 :mnemonic ?J
57 :designation [(ascii japanese-jisx0208-1978 japanese-jisx0208
58 latin-jisx0201 japanese-jisx0212
59 chinese-gb2312 korean-ksc5601)
60 nil
61 (nil latin-iso8859-1 greek-iso8859-7)
62 nil]
63 :flags '(short ascii-at-eol ascii-at-cntl 7-bit designation single-shift
64 init-at-bol)
65 :charset-list '(ascii japanese-jisx0208 japanese-jisx0212
66 latin-jisx0201 japanese-jisx0208-1978
67 chinese-gb2312 korean-ksc5601
68 latin-iso8859-1 greek-iso8859-7)
69 :mime-charset 'iso-2022-jp-2)
70
71 (let ((map ; JIS vs CP932
72 '((#x301C . #xFF5E) ; WAVE DASH FULLWIDTH TILDE
73 (#x2016 . #x2225) ; DOUBLE VERTICAL LINE PARALLEL TO
74 (#x2212 . #xFF0D) ; MINUS SIGN FULLWIDTH HYPHEN-MINUS
75 (#x00A2 . #xFFE0) ; CENT SIGN FULLWIDTH CENT SIGN
76 (#x00A3 . #xFFE1) ; POUND SIGN FULLWIDTH POUND SIGN
77 (#x00AC . #xFFE2) ; NOT SIGN FULLWIDTH NOT SIGN
78 (#x00A6 . #xFFE4) ; BROKEN LINE FULLWIDTH BROKEN LINE
79 )))
80 (define-translation-table 'japanese-ucs-cp932-map map)
81 (mapc #'(lambda (x) (let ((tmp (car x)))
82 (setcar x (cdr x)) (setcdr x tmp)))
83 map)
84 (define-translation-table 'japanese-ucs-jis-map map)
85 (define-translation-table 'japanese-ucs-glibc-map map))
86
87 ;; U+2014 (EM DASH) vs U+2015 (HORIZONTAL BAR)
88 (aset (get 'japanese-ucs-cp932-map 'translation-table) #x2014 #x2015)
89 (aset (get 'japanese-ucs-jis-map 'translation-table) #x2015 #x2014)
90 (aset (get 'japanese-ucs-glibc-map 'translation-table) #x2014 #x2015)
91
92 (define-coding-system 'japanese-shift-jis
93 "Shift-JIS 8-bit encoding for Japanese (MIME:SHIFT_JIS)"
94 :coding-type 'shift-jis
95 :mnemonic ?S
96 :charset-list '(ascii katakana-jisx0201 japanese-jisx0208)
97 :mime-charset 'shift_jis)
98
99 (define-coding-system-alias 'shift_jis 'japanese-shift-jis)
100 (define-coding-system-alias 'sjis 'japanese-shift-jis)
101
102 (define-coding-system 'japanese-cp932
103 "CP932 (Microsoft shift-jis)"
104 :coding-type 'charset
105 :mnemonic ?S
106 :charset-list '(ascii katakana-sjis cp932-2-byte))
107
108 (define-coding-system-alias 'cp932 'japanese-cp932)
109
110 (define-coding-system 'japanese-iso-7bit-1978-irv
111 "ISO 2022 based 7-bit encoding for Japanese JISX0208-1978 and JISX0201-Roman."
112 :coding-type 'iso-2022
113 :mnemonic ?j
114 :designation [(latin-jisx0201 japanese-jisx0208-1978 japanese-jisx0208
115 japanese-jisx0212 katakana-jisx0201)
116 nil nil nil]
117 :flags '(short ascii-at-eol ascii-at-cntl 7-bit designation
118 use-roman use-oldjis)
119 :charset-list '(ascii latin-jisx0201 japanese-jisx0208-1978 japanese-jisx0208
120 japanese-jisx0212))
121
122 (define-coding-system-alias 'iso-2022-jp-1978-irv 'japanese-iso-7bit-1978-irv)
123 (define-coding-system-alias 'old-jis 'japanese-iso-7bit-1978-irv)
124
125 (define-coding-system 'japanese-iso-8bit
126 "ISO 2022 based EUC encoding for Japanese (MIME:EUC-JP)."
127 :coding-type 'iso-2022
128 :mnemonic ?E
129 :designation [ascii japanese-jisx0208 katakana-jisx0201 japanese-jisx0212]
130 :flags '(short ascii-at-eol ascii-at-cntl single-shift)
131 :charset-list '(ascii latin-jisx0201 japanese-jisx0208
132 japanese-jisx0208-1978
133 katakana-jisx0201 japanese-jisx0212)
134 :mime-charset 'euc-jp)
135
136 (define-coding-system-alias 'euc-japan-1990 'japanese-iso-8bit)
137 (define-coding-system-alias 'euc-japan 'japanese-iso-8bit)
138 (define-coding-system-alias 'euc-jp 'japanese-iso-8bit)
139
140 (define-coding-system 'eucjp-ms
141 "eucJP-ms (like EUC-JP but with CP932 extension).
142 eucJP-ms is defined in <http://www.opengroup.or.jp/jvc/cde/appendix.html>."
143 :coding-type 'iso-2022
144 :mnemonic ?E
145 :designation [ascii japanese-jisx0208 katakana-jisx0201 japanese-jisx0212]
146 :flags '(short ascii-at-eol ascii-at-cntl single-shift)
147 :charset-list '(ascii latin-jisx0201 japanese-jisx0208
148 katakana-jisx0201 japanese-jisx0212)
149 :decode-translation-table 'eucjp-ms-decode
150 :encode-translation-table 'eucjp-ms-encode)
151
152 (set-language-info-alist
153 "Japanese" '((setup-function . setup-japanese-environment-internal)
154 (tutorial . "TUTORIAL.ja")
155 (charset japanese-jisx0208 japanese-jisx0208-1978
156 japanese-jisx0212 latin-jisx0201 katakana-jisx0201
157 japanese-jisx0213-1 japanese-jisx0213-2)
158 (coding-system iso-2022-jp japanese-iso-8bit
159 japanese-shift-jis japanese-iso-7bit-1978-irv)
160 (coding-priority iso-2022-jp japanese-iso-8bit
161 japanese-shift-jis iso-2022-jp-2)
162 (input-method . "japanese")
163 (features japan-util)
164 (sample-text . "Japanese (\e$BF|K\8l\e(B) \e$B$3$s$K$A$O\e(B, \e(I:]FAJ\e(B")
165 (documentation . t)))
166
167 (provide 'japanese)
168
169 ;;; japanese.el ends here