Mercurial > emacs
annotate lisp/international/utf-16.el @ 50454:583825022e8f
(Info-goto-emacs-command-node): If command
is given as a string, convert it to a symbol.
author | Masatake YAMATO <jet@gyve.org> |
---|---|
date | Sat, 05 Apr 2003 18:01:14 +0000 |
parents | 12444cb90785 |
children | 15382232cf57 |
rev | line source |
---|---|
46677 | 1 ;;; utf-16.el --- UTF-16 encoding/decoding |
2 | |
3 ;; Copyright (C) 2001, 2002 Free Software Foundation, Inc. | |
4 | |
5 ;; Author: Dave Love <fx@gnu.org> | |
6 ;; Keywords: Unicode, UTF-16, i18n | |
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 ;; Support for UTF-16, which is a two-byte encoding (modulo | |
28 ;; surrogates) of Unicode, written either in little or big endian | |
29 ;; order: coding-systems `mule-utf-16-le' and `mule-utf-16-be'. | |
30 ;; (utf-16-le is used by the DozeN'T clipboard, for instance.) The | |
31 ;; data are preceeded by a two-byte signature which identifies their | |
32 ;; byte sex. These are used by the coding-category-utf-16-{b,l}e code | |
33 ;; to identify the coding, but ignored on decoding. | |
34 | |
35 ;; Note that un-decodable sequences aren't (yet?) preserved as raw | |
36 ;; bytes, as they are with utf-8, so reading and writing as utf-16 can | |
37 ;; corrupt data. | |
38 | |
39 ;;; Code: | |
40 | |
41 ;; We end up with trivially different -le and -be versions of most | |
42 ;; things below, sometimes with commonality abstracted into a let | |
43 ;; binding for maintenance convenience. | |
44 | |
45 ;; We'd need new charsets distinct from ascii and eight-bit-control to | |
46 ;; deal with untranslated sequences, since we can't otherwise | |
47 ;; distinguish the bytes, as we can with utf-8. | |
48 | |
49 ;; ;; Do a multibyte write for bytes in r3 and r4. | |
50 ;; ;; Intended for untranslatable utf-16 sequences. | |
51 ;; (define-ccl-program ccl-mule-utf-16-untrans | |
52 ;; `(0 | |
53 ;; (if (r3 < 128) | |
54 ;; (r0 = ,(charset-id 'ascii)) | |
55 ;; (if (r3 < 160) | |
56 ;; (r0 = ,(charset-id 'eight-bit-control)) | |
57 ;; (r0 = ,(charset-id 'eight-bit-graphic)))) | |
58 ;; (if (r4 < 128) | |
59 ;; (r0 = ,(charset-id 'ascii)) | |
60 ;; (if (r4 < 160) | |
61 ;; (r0 = ,(charset-id 'eight-bit-control)) | |
62 ;; (r0 = ,(charset-id 'eight-bit-graphic)))) | |
63 ;; (r1 = r4))) | |
64 ;; "Do a multibyte write for bytes in r3 and r4. | |
65 ;; First swap them if we're big endian, indicated by r5==0. | |
66 ;; Intended for untranslatable utf-16 sequences.") | |
67 | |
68 ;; Needed in macro expansion, so can't be let-bound. Zapped after use. | |
69 (eval-and-compile | |
70 (defconst utf-16-decode-ucs | |
50349
12444cb90785
(ccl-decode-mule-utf-16-le): Don't assume the signature bytes.
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
71 ;; We have the unicode in r1. Output is charset ID in r0, code |
12444cb90785
(ccl-decode-mule-utf-16-le): Don't assume the signature bytes.
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
72 ;; point in r1. As r6 keeps endian information, the value should |
12444cb90785
(ccl-decode-mule-utf-16-le): Don't assume the signature bytes.
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
73 ;; not be changed. |
47705
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
74 `((lookup-integer utf-subst-table-for-decode r1 r3) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
75 (if r7 ; got a translation |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
76 ((r0 = r1) (r1 = r3)) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
77 (if (r1 < 128) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
78 (r0 = ,(charset-id 'ascii)) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
79 (if (r1 < 160) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
80 (r0 = ,(charset-id 'eight-bit-control)) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
81 (if (r1 < 256) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
82 ((r0 = ,(charset-id 'latin-iso8859-1)) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
83 (r1 -= 128)) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
84 (if (r1 < #x2500) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
85 ((r0 = ,(charset-id 'mule-unicode-0100-24ff)) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
86 (r1 -= #x100) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
87 (r2 = (((r1 / 96) + 32) << 7)) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
88 (r1 %= 96) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
89 (r1 += (r2 + 32))) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
90 (if (r1 < #x3400) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
91 ((r0 = ,(charset-id 'mule-unicode-2500-33ff)) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
92 (r1 -= #x2500) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
93 (r2 = (((r1 / 96) + 32) << 7)) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
94 (r1 %= 96) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
95 (r1 += (r2 + 32))) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
96 (if (r1 < #xd800) ; 2 untranslated bytes |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
97 ;; ;; Assume this is rare, so don't worry about the |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
98 ;; ;; overhead of the call. |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
99 ;; (call mule-utf-16-untrans) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
100 ((r0 = ,(charset-id 'mule-unicode-e000-ffff)) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
101 (r1 = 15037)) ; U+fffd |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
102 (if (r1 < #xe000) ; surrogate |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
103 ;; ((call mule-utf-16-untrans) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
104 ;; (write-multibyte-character r0 r1) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
105 ;; (read r3 r4) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
106 ;; (call mule-utf-16-untrans)) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
107 ((read r3 r4) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
108 (r0 = ,(charset-id 'mule-unicode-e000-ffff)) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
109 (r1 = 15037)) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
110 ((r0 = ,(charset-id 'mule-unicode-e000-ffff)) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
111 (r1 -= #xe000) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
112 (r2 = (((r1 / 96) + 32) << 7)) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
113 (r1 %= 96) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
114 (r1 += (r2 + 32)))))))))))))) |
46677 | 115 |
116 (define-ccl-program ccl-decode-mule-utf-16-le | |
117 `(2 ; 2 bytes -> 1 to 4 bytes | |
50349
12444cb90785
(ccl-decode-mule-utf-16-le): Don't assume the signature bytes.
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
118 ((loop |
46677 | 119 (read r3 r4) |
120 (r1 = (r4 <8 r3)) | |
121 ,utf-16-decode-ucs | |
47705
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
122 (translate-character utf-translation-table-for-decode r0 r1) |
46677 | 123 (write-multibyte-character r0 r1) |
124 (repeat)))) | |
50349
12444cb90785
(ccl-decode-mule-utf-16-le): Don't assume the signature bytes.
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
125 "Decode UTF-16LE (little endian without signature bytes). |
46677 | 126 Basic decoding is done into the charsets ascii, latin-iso8859-1 and |
47705
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
127 mule-unicode-*. Un-representable Unicode characters are decoded as |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
128 U+fffd. The result is run through the translation-table named |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
129 `utf-translation-table-for-decode'.") |
46677 | 130 |
131 (define-ccl-program ccl-decode-mule-utf-16-be | |
132 `(2 ; 2 bytes -> 1 to 4 bytes | |
50349
12444cb90785
(ccl-decode-mule-utf-16-le): Don't assume the signature bytes.
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
133 ((loop |
46677 | 134 (read r3 r4) |
135 (r1 = (r3 <8 r4)) | |
136 ,utf-16-decode-ucs | |
47705
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
137 (translate-character utf-translation-table-for-decode r0 r1) |
46677 | 138 (write-multibyte-character r0 r1) |
139 (repeat)))) | |
50349
12444cb90785
(ccl-decode-mule-utf-16-le): Don't assume the signature bytes.
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
140 "Decode UTF-16BE (big endian without signature bytes). |
46677 | 141 Basic decoding is done into the charsets ascii, latin-iso8859-1 and |
142 mule-unicode-*. Un-representable Unicode characters are | |
47705
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
143 decoded as U+fffd. The result is run through the translation-table of |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
144 name `utf-translation-table-for-decode'.") |
46677 | 145 |
146 (makunbound 'utf-16-decode-ucs) ; done with it | |
147 | |
148 (eval-and-compile | |
149 (defconst utf-16-decode-to-ucs | |
150 ;; CCL which, given the result of a multibyte read in r0 and r1, | |
151 ;; sets r0 to the character's Unicode if the charset is one of the | |
152 ;; basic utf-8 coding system ones. Otherwise set to U+fffd. | |
153 `(if (r0 == ,(charset-id 'ascii)) | |
154 (r0 = r1) | |
155 (if (r0 == ,(charset-id 'latin-iso8859-1)) | |
156 (r0 = (r1 + 128)) | |
157 (if (r0 == ,(charset-id 'eight-bit-control)) | |
158 (r0 = r1) | |
159 (if (r0 == ,(charset-id 'eight-bit-graphic)) | |
160 (r0 = r1) | |
161 ((r2 = (r1 & #x7f)) | |
162 (r1 >>= 7) | |
163 (r3 = ((r1 - 32) * 96)) | |
164 (r3 += (r2 - 32)) | |
165 (if (r0 == ,(charset-id 'mule-unicode-0100-24ff)) | |
166 (r0 = (r3 + #x100)) | |
167 (if (r0 == ,(charset-id 'mule-unicode-2500-33ff)) | |
168 (r0 = (r3 + #x2500)) | |
169 (if (r0 == ,(charset-id 'mule-unicode-e000-ffff)) | |
170 (r0 = (r3 + #xe000)) | |
171 (r0 = #xfffd))))))))))) | |
172 | |
173 (define-ccl-program ccl-encode-mule-utf-16-le | |
174 `(1 | |
50349
12444cb90785
(ccl-decode-mule-utf-16-le): Don't assume the signature bytes.
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
175 ((loop |
46677 | 176 (read-multibyte-character r0 r1) |
47705
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
177 (lookup-character utf-subst-table-for-encode r0 r1) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
178 (if (r7 == 0) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
179 ((translate-character utf-translation-table-for-encode r0 r1) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
180 ,utf-16-decode-to-ucs)) |
46677 | 181 (write (r0 & 255)) |
182 (write (r0 >> 8)) | |
183 (repeat)))) | |
50349
12444cb90785
(ccl-decode-mule-utf-16-le): Don't assume the signature bytes.
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
184 "Encode to UTF-16LE (little endian without signature). |
46677 | 185 Characters from the charsets ascii, eight-bit-control, |
186 eight-bit-graphic, latin-iso8859-1 and mule-unicode-* are encoded | |
47705
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
187 after translation through the translation-table of name |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
188 `utf-translation-table-for-encode'. |
46677 | 189 Others are encoded as U+FFFD.") |
190 | |
191 (define-ccl-program ccl-encode-mule-utf-16-be | |
192 `(1 | |
50349
12444cb90785
(ccl-decode-mule-utf-16-le): Don't assume the signature bytes.
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
193 ((loop |
46677 | 194 (read-multibyte-character r0 r1) |
47705
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
195 (lookup-character utf-subst-table-for-encode r0 r1) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
196 (if (r7 == 0) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
197 ((translate-character utf-translation-table-for-encode r0 r1) |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
198 ,utf-16-decode-to-ucs)) |
46677 | 199 (write (r0 >> 8)) |
200 (write (r0 & 255)) | |
201 (repeat)))) | |
50349
12444cb90785
(ccl-decode-mule-utf-16-le): Don't assume the signature bytes.
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
202 "Encode to UTF-16BE (big endian without signature). |
46677 | 203 Characters from the charsets ascii, eight-bit-control, |
204 eight-bit-graphic, latin-iso8859-1 and mule-unicode-* are encoded | |
47705
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
205 after translation through the translation-table named |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
206 `utf-translation-table-for-encode'. |
46677 | 207 Others are encoded as U+FFFD.") |
208 | |
209 (makunbound 'utf-16-decode-to-ucs) | |
210 | |
211 (let ((doc " | |
212 | |
47705
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
213 It supports Unicode characters of these ranges: |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
214 U+0000..U+33FF, U+E000..U+FFFF. |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
215 They correspond to these Emacs character sets: |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
216 ascii, latin-iso8859-1, mule-unicode-0100-24ff, |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
217 mule-unicode-2500-33ff, mule-unicode-e000-ffff |
46677 | 218 |
47705
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
219 On decoding (e.g. reading a file), Unicode characters not in the above |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
220 ranges are decoded as U+FFFD, effectively corrupting the data |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49203
diff
changeset
|
221 if they are re-encoded. |
47705
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
222 |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
223 On encoding (e.g. writing a file), Emacs characters not belonging to |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
224 any of the character sets listed above are encoded into the byte |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
225 sequence representing U+FFFD (REPLACEMENT CHARACTER).")) |
46677 | 226 (make-coding-system |
227 'mule-utf-16-le 4 | |
228 ?u ; Mule-UCS uses ?U, but code-pages uses that for koi8-u. | |
229 (concat | |
230 "Little endian UTF-16 encoding for Emacs-supported Unicode characters." | |
231 doc) | |
232 | |
233 '(ccl-decode-mule-utf-16-le . ccl-encode-mule-utf-16-le) | |
234 '((safe-charsets | |
235 ascii | |
236 eight-bit-control | |
237 latin-iso8859-1 | |
238 mule-unicode-0100-24ff | |
239 mule-unicode-2500-33ff | |
240 mule-unicode-e000-ffff) | |
241 (mime-charset . utf-16le) | |
242 (coding-category . coding-category-utf-16-le) | |
243 (valid-codes (0 . 255)) | |
47705
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
244 (dependency unify-8859-on-encoding-mode |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
245 unify-8859-on-decoding-mode |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
246 utf-fragment-on-decoding |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
247 utf-translate-cjk))) |
46677 | 248 |
249 (make-coding-system | |
250 'mule-utf-16-be 4 ?u | |
251 (concat | |
252 "Big endian UTF-16 encoding for Emacs-supported Unicode characters." | |
253 doc) | |
254 | |
255 '(ccl-decode-mule-utf-16-be . ccl-encode-mule-utf-16-be) | |
256 '((safe-charsets | |
257 ascii | |
258 eight-bit-control | |
259 latin-iso8859-1 | |
260 mule-unicode-0100-24ff | |
261 mule-unicode-2500-33ff | |
262 mule-unicode-e000-ffff) | |
263 (mime-charset . utf-16be) | |
264 (coding-category . coding-category-utf-16-be) | |
265 (valid-codes (0 . 255)) | |
47705
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
266 (dependency unify-8859-on-encoding-mode |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
267 unify-8859-on-decoding-mode |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
268 utf-fragment-on-decoding |
797c350a7f8c
(utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents:
47384
diff
changeset
|
269 utf-translate-cjk)))) |
46677 | 270 |
271 (define-coding-system-alias 'utf-16-le 'mule-utf-16-le) | |
272 (define-coding-system-alias 'utf-16-be 'mule-utf-16-be) | |
273 | |
274 ;;; utf-16.el ends here |