annotate lisp/international/utf-16.el @ 51380:0254c3b1ede8

(openp): Make sure STR is a string.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sun, 01 Jun 2003 18:03:00 +0000
parents 15382232cf57
children bc72d6855260
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
1 ;;; utf-16.el --- UTF-16 encoding/decoding
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
2
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
3 ;; Copyright (C) 2001, 2002 Free Software Foundation, Inc.
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
4
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
5 ;; Author: Dave Love <fx@gnu.org>
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
6 ;; Keywords: Unicode, UTF-16, i18n
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
7
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
9
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
13 ;; any later version.
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
14
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
18 ;; GNU General Public License for more details.
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
19
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
23 ;; Boston, MA 02111-1307, USA.
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
24
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
25 ;;; Commentary:
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
26
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
27 ;; Support for UTF-16, which is a two-byte encoding (modulo
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
28 ;; surrogates) of Unicode, written either in little or big endian
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
29 ;; order: coding-systems `mule-utf-16-le' and `mule-utf-16-be'.
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
30 ;; (utf-16-le is used by the DozeN'T clipboard, for instance.) The
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
31 ;; data are preceeded by a two-byte signature which identifies their
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
32 ;; byte sex. These are used by the coding-category-utf-16-{b,l}e code
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
33 ;; to identify the coding, but ignored on decoding.
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
34
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
35 ;; Note that un-decodable sequences aren't (yet?) preserved as raw
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
36 ;; bytes, as they are with utf-8, so reading and writing as utf-16 can
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
37 ;; corrupt data.
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
38
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
39 ;;; Code:
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
40
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
41 ;; We end up with trivially different -le and -be versions of most
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
42 ;; things below, sometimes with commonality abstracted into a let
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
43 ;; binding for maintenance convenience.
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
44
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
45 ;; We'd need new charsets distinct from ascii and eight-bit-control to
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
46 ;; deal with untranslated sequences, since we can't otherwise
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
47 ;; distinguish the bytes, as we can with utf-8.
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
48
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
49 ;; ;; Do a multibyte write for bytes in r3 and r4.
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
50 ;; ;; Intended for untranslatable utf-16 sequences.
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
51 ;; (define-ccl-program ccl-mule-utf-16-untrans
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
52 ;; `(0
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
53 ;; (if (r3 < 128)
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
54 ;; (r0 = ,(charset-id 'ascii))
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
55 ;; (if (r3 < 160)
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
56 ;; (r0 = ,(charset-id 'eight-bit-control))
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
57 ;; (r0 = ,(charset-id 'eight-bit-graphic))))
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
58 ;; (if (r4 < 128)
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
59 ;; (r0 = ,(charset-id 'ascii))
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
60 ;; (if (r4 < 160)
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
61 ;; (r0 = ,(charset-id 'eight-bit-control))
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
62 ;; (r0 = ,(charset-id 'eight-bit-graphic))))
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
63 ;; (r1 = r4)))
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
64 ;; "Do a multibyte write for bytes in r3 and r4.
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
65 ;; First swap them if we're big endian, indicated by r5==0.
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
66 ;; Intended for untranslatable utf-16 sequences.")
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
67
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
68 ;; Needed in macro expansion, so can't be let-bound. Zapped after use.
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
69 (eval-and-compile
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
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
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
72 ;; point in r1.
47705
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
73 `((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
74 (if r7 ; got a translation
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
75 ((r0 = r1) (r1 = r3))
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
76 (if (r1 < 128)
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
77 (r0 = ,(charset-id 'ascii))
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
78 (if (r1 < 160)
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
79 (r0 = ,(charset-id 'eight-bit-control))
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
80 (if (r1 < 256)
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
81 ((r0 = ,(charset-id 'latin-iso8859-1))
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
82 (r1 -= 128))
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
83 (if (r1 < #x2500)
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
84 ((r0 = ,(charset-id 'mule-unicode-0100-24ff))
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
85 (r1 -= #x100)
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
86 (r2 = (((r1 / 96) + 32) << 7))
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
87 (r1 %= 96)
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
88 (r1 += (r2 + 32)))
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
89 (if (r1 < #x3400)
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
90 ((r0 = ,(charset-id 'mule-unicode-2500-33ff))
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
91 (r1 -= #x2500)
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
92 (r2 = (((r1 / 96) + 32) << 7))
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
93 (r1 %= 96)
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
94 (r1 += (r2 + 32)))
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
95 (if (r1 < #xd800) ; 2 untranslated bytes
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
96 ;; ;; 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
97 ;; ;; overhead of the call.
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
98 ;; (call mule-utf-16-untrans)
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
99 ((r0 = ,(charset-id 'mule-unicode-e000-ffff))
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
100 (r1 = 15037)) ; U+fffd
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
101 (if (r1 < #xe000) ; surrogate
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
102 ;; ((call mule-utf-16-untrans)
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
103 ;; (write-multibyte-character r0 r1)
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
104 ;; (read r3 r4)
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
105 ;; (call mule-utf-16-untrans))
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
106 ((read r3 r4)
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
107 (r0 = ,(charset-id 'mule-unicode-e000-ffff))
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
108 (r1 = 15037))
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
109 ((r0 = ,(charset-id 'mule-unicode-e000-ffff))
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
110 (r1 -= #xe000)
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
111 (r2 = (((r1 / 96) + 32) << 7))
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
112 (r1 %= 96)
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
113 (r1 += (r2 + 32)))))))))))))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
114
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
115 (defconst utf-16-le-decode-loop
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
116 `(loop
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
117 (read r3 r4)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
118 (r1 = (r4 <8 r3))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
119 ,utf-16-decode-ucs
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
120 (translate-character utf-translation-table-for-decode r0 r1)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
121 (write-multibyte-character r0 r1)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
122 (repeat)))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
123
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
124 (defconst utf-16-be-decode-loop
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
125 `(loop
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
126 (read r3 r4)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
127 (r1 = (r3 <8 r4))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
128 ,@utf-16-decode-ucs
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
129 (translate-character utf-translation-table-for-decode r0 r1)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
130 (write-multibyte-character r0 r1)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
131 (repeat)))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
132
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
133 )
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
134
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
135 (define-ccl-program ccl-decode-mule-utf-16-le
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
136 `(2 ; 2 bytes -> 1 to 4 bytes
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
137 ,utf-16-le-decode-loop)
50349
12444cb90785 (ccl-decode-mule-utf-16-le): Don't assume the signature bytes.
Kenichi Handa <handa@m17n.org>
parents: 49598
diff changeset
138 "Decode UTF-16LE (little endian without signature bytes).
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
139 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
140 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
141 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
142 `utf-translation-table-for-decode'.")
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
143
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
144 (define-ccl-program ccl-decode-mule-utf-16-be
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
145 `(2 ; 2 bytes -> 1 to 4 bytes
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
146 ,utf-16-be-decode-loop)
50349
12444cb90785 (ccl-decode-mule-utf-16-le): Don't assume the signature bytes.
Kenichi Handa <handa@m17n.org>
parents: 49598
diff changeset
147 "Decode UTF-16BE (big endian without signature bytes).
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
148 Basic decoding is done into the charsets ascii, latin-iso8859-1 and
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
149 mule-unicode-*. Un-representable Unicode characters are
47705
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
150 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
151 name `utf-translation-table-for-decode'.")
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
152
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
153 (define-ccl-program ccl-decode-mule-utf-16-le-with-signature
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
154 `(2
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
155 ((read r3 r4)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
156 ,utf-16-le-decode-loop))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
157 "Like ccl-decode-utf-16-le but skip the first 2-byte BOM.")
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
158
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
159 (define-ccl-program ccl-decode-mule-utf-16-be-with-signature
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
160 `(2
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
161 ((read r3 r4)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
162 ,utf-16-be-decode-loop))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
163 "Like ccl-decode-utf-16-be but skip the first 2-byte BOM.")
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
164
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
165 (define-ccl-program ccl-decode-mule-utf-16
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
166 `(2
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
167 ((read r3 r4)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
168 (r1 = (r3 <8 r4))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
169 (if (r1 == #xFFFE)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
170 ;; R1 is a BOM for little endian. We keep this character as
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
171 ;; is temporarily. It is removed by post-read-conversion
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
172 ;; function.
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
173 (,@utf-16-decode-ucs
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
174 (write-multibyte-character r0 r1)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
175 ,utf-16-le-decode-loop)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
176 ((if (r1 == #xFEFF)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
177 ;; R1 is a BOM for big endian, but we can't keep that
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
178 ;; character in the output because it can't be
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
179 ;; distinguished with the normal U+FEFF. So, we keep
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
180 ;; #xFFFF instead.
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
181 ((r1 = #xFFFF)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
182 ,@utf-16-decode-ucs)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
183 ;; R1 a normal Unicode character.
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
184 (,@utf-16-decode-ucs
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
185 (translate-character utf-translation-table-for-decode r0 r1)))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
186 (write-multibyte-character r0 r1)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
187 ,utf-16-be-decode-loop))))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
188 "Like ccl-decode-utf-16-be/le but check the first BOM.")
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
189
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
190 (makunbound 'utf-16-decode-ucs) ; done with it
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
191 (makunbound 'utf-16-le-decode-loop)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
192 (makunbound 'utf-16-be-decode-loop)
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
193
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
194 (eval-and-compile
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
195 (defconst utf-16-decode-to-ucs
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
196 ;; CCL which, given the result of a multibyte read in r0 and r1,
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
197 ;; sets r0 to the character's Unicode if the charset is one of the
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
198 ;; basic utf-8 coding system ones. Otherwise set to U+fffd.
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
199 `(if (r0 == ,(charset-id 'ascii))
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
200 (r0 = r1)
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
201 (if (r0 == ,(charset-id 'latin-iso8859-1))
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
202 (r0 = (r1 + 128))
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
203 (if (r0 == ,(charset-id 'eight-bit-control))
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
204 (r0 = r1)
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
205 (if (r0 == ,(charset-id 'eight-bit-graphic))
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
206 (r0 = r1)
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
207 ((r2 = (r1 & #x7f))
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
208 (r1 >>= 7)
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
209 (r3 = ((r1 - 32) * 96))
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
210 (r3 += (r2 - 32))
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
211 (if (r0 == ,(charset-id 'mule-unicode-0100-24ff))
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
212 (r0 = (r3 + #x100))
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
213 (if (r0 == ,(charset-id 'mule-unicode-2500-33ff))
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
214 (r0 = (r3 + #x2500))
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
215 (if (r0 == ,(charset-id 'mule-unicode-e000-ffff))
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
216 (r0 = (r3 + #xe000))
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
217 (r0 = #xfffd))))))))))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
218
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
219 (defconst utf-16-le-encode-loop
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
220 `(loop
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
221 (read-multibyte-character r0 r1)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
222 (lookup-character utf-subst-table-for-encode r0 r1)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
223 (if (r7 == 0)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
224 ((translate-character utf-translation-table-for-encode r0 r1)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
225 ,utf-16-decode-to-ucs))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
226 (write (r0 & 255))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
227 (write (r0 >> 8))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
228 (repeat)))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
229
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
230 (defconst utf-16-be-encode-loop
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
231 `(loop
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
232 (read-multibyte-character r0 r1)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
233 (lookup-character utf-subst-table-for-encode r0 r1)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
234 (if (r7 == 0)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
235 ((translate-character utf-translation-table-for-encode r0 r1)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
236 ,utf-16-decode-to-ucs))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
237 (write (r0 >> 8))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
238 (write (r0 & 255))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
239 (repeat)))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
240 )
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
241
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
242 (define-ccl-program ccl-encode-mule-utf-16-le
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
243 `(1
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
244 ,utf-16-le-encode-loop)
50349
12444cb90785 (ccl-decode-mule-utf-16-le): Don't assume the signature bytes.
Kenichi Handa <handa@m17n.org>
parents: 49598
diff changeset
245 "Encode to UTF-16LE (little endian without signature).
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
246 Characters from the charsets ascii, eight-bit-control,
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
247 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
248 after translation through the translation-table of name
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
249 `utf-translation-table-for-encode'.
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
250 Others are encoded as U+FFFD.")
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
251
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
252 (define-ccl-program ccl-encode-mule-utf-16-be
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
253 `(1
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
254 ,utf-16-be-encode-loop)
50349
12444cb90785 (ccl-decode-mule-utf-16-le): Don't assume the signature bytes.
Kenichi Handa <handa@m17n.org>
parents: 49598
diff changeset
255 "Encode to UTF-16BE (big endian without signature).
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
256 Characters from the charsets ascii, eight-bit-control,
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
257 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
258 after translation through the translation-table named
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
259 `utf-translation-table-for-encode'.
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
260 Others are encoded as U+FFFD.")
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
261
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
262 (define-ccl-program ccl-encode-mule-utf-16-le-with-signature
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
263 `(1
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
264 ((write #xFF)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
265 (write #xFE)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
266 ,utf-16-le-encode-loop))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
267 "Encode to UTF-16 (little endian with signature).
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
268 Characters from the charsets ascii, eight-bit-control,
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
269 eight-bit-graphic, latin-iso8859-1 and mule-unicode-* are encoded
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
270 after translation through the translation-table of name
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
271 `utf-translation-table-for-encode'.
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
272 Others are encoded as U+FFFD.")
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
273
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
274 (define-ccl-program ccl-encode-mule-utf-16-be-with-signature
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
275 `(1
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
276 ((write #xFE)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
277 (write #xFF)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
278 ,utf-16-be-encode-loop))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
279 "Encode to UTF-16 (big endian with signature).
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
280 Characters from the charsets ascii, eight-bit-control,
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
281 eight-bit-graphic, latin-iso8859-1 and mule-unicode-* are encoded
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
282 after translation through the translation-table named
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
283 `utf-translation-table-for-encode'.
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
284 Others are encoded as U+FFFD.")
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
285
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
286 (makunbound 'utf-16-decode-to-ucs)
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
287 (makunbound 'utf-16-le-encode-loop)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
288 (makunbound 'utf-16-be-encode-loop)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
289
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
290 (defun mule-utf-16-post-read-conversion (length)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
291 (when (> length 0)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
292 (let ((char (following-char)))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
293 (cond ((= char (decode-char 'ucs #xFFFE))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
294 (delete-char 1)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
295 (setq last-coding-system-used
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
296 (coding-system-change-text-conversion
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
297 last-coding-system-used
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
298 'mule-utf-16-le-with-signature))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
299 (setq length (1- length)))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
300 ((= char (decode-char 'ucs #xFFFF))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
301 (delete-char 1)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
302 (setq last-coding-system-used
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
303 (coding-system-change-text-conversion
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
304 last-coding-system-used
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
305 'mule-utf-16-be-with-signature))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
306 (setq length (1- length)))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
307 (t
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
308 (setq last-coding-system-used 'mule-utf-16-be)))))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
309 length)
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
310
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
311 (let ((doc "
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
312
47705
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
313 It supports Unicode characters of these ranges:
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
314 U+0000..U+33FF, U+E000..U+FFFF.
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
315 They correspond to these Emacs character sets:
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
316 ascii, latin-iso8859-1, mule-unicode-0100-24ff,
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
317 mule-unicode-2500-33ff, mule-unicode-e000-ffff
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
318
47705
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
319 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
320 ranges are decoded as U+FFFD, effectively corrupting the data
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49203
diff changeset
321 if they are re-encoded.
47705
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
322
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
323 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
324 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
325 sequence representing U+FFFD (REPLACEMENT CHARACTER)."))
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
326 (make-coding-system
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
327 'mule-utf-16-le 4
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
328 ?u ; Mule-UCS uses ?U, but code-pages uses that for koi8-u.
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
329 (concat
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
330 "Little endian UTF-16 encoding for Emacs-supported Unicode characters."
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
331 doc)
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
332
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
333 '(ccl-decode-mule-utf-16-le . ccl-encode-mule-utf-16-le)
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
334 '((safe-charsets
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
335 ascii
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
336 eight-bit-control
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
337 latin-iso8859-1
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
338 mule-unicode-0100-24ff
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
339 mule-unicode-2500-33ff
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
340 mule-unicode-e000-ffff)
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
341 (mime-charset . utf-16le)
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
342 (valid-codes (0 . 255))
47705
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
343 (dependency unify-8859-on-encoding-mode
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
344 unify-8859-on-decoding-mode
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
345 utf-fragment-on-decoding
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
346 utf-translate-cjk)))
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
347
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
348 (make-coding-system
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
349 'mule-utf-16-be 4 ?u
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
350 (concat
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
351 "Big endian UTF-16 encoding for Emacs-supported Unicode characters."
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
352 doc)
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
353
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
354 '(ccl-decode-mule-utf-16-be . ccl-encode-mule-utf-16-be)
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
355 '((safe-charsets
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
356 ascii
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
357 eight-bit-control
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
358 latin-iso8859-1
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
359 mule-unicode-0100-24ff
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
360 mule-unicode-2500-33ff
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
361 mule-unicode-e000-ffff)
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
362 (mime-charset . utf-16be)
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
363 (valid-codes (0 . 255))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
364 (dependency unify-8859-on-encoding-mode
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
365 unify-8859-on-decoding-mode
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
366 utf-fragment-on-decoding
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
367 utf-translate-cjk)))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
368
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
369 (make-coding-system
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
370 'mule-utf-16-le-with-signature 4 ?u
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
371 (concat
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
372 "Little endian UTF-16 (with BOM) for Emacs-supported Unicode characters."
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
373 doc)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
374
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
375 '(ccl-decode-mule-utf-16-le-with-signature
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
376 . ccl-encode-mule-utf-16-le-with-signature)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
377 '((safe-charsets
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
378 ascii
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
379 eight-bit-control
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
380 latin-iso8859-1
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
381 mule-unicode-0100-24ff
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
382 mule-unicode-2500-33ff
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
383 mule-unicode-e000-ffff)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
384 (coding-category . coding-category-utf-16-le)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
385 (mime-charset . utf-16)
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
386 (valid-codes (0 . 255))
47705
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
387 (dependency unify-8859-on-encoding-mode
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
388 unify-8859-on-decoding-mode
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
389 utf-fragment-on-decoding
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
390 utf-translate-cjk)))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
391
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
392 (make-coding-system
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
393 'mule-utf-16-be-with-signature 4 ?u
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
394 (concat
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
395 "Big endian UTF-16 (with BOM) for Emacs-supported Unicode characters."
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
396 doc)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
397
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
398 '(ccl-decode-mule-utf-16-be-with-signature
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
399 . ccl-encode-mule-utf-16-be-with-signature)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
400 '((safe-charsets
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
401 ascii
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
402 eight-bit-control
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
403 latin-iso8859-1
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
404 mule-unicode-0100-24ff
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
405 mule-unicode-2500-33ff
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
406 mule-unicode-e000-ffff)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
407 (coding-category . coding-category-utf-16-be)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
408 (mime-charset . utf-16)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
409 (valid-codes (0 . 255))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
410 (dependency unify-8859-on-encoding-mode
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
411 unify-8859-on-decoding-mode
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
412 utf-fragment-on-decoding
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
413 utf-translate-cjk)))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
414
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
415 (make-coding-system
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
416 'mule-utf-16 4 ?u
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
417 (concat
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
418 "UTF-16 (with or without BOM) for Emacs-supported Unicode characters."
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
419 doc)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
420
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
421 '(ccl-decode-mule-utf-16 . ccl-encode-mule-utf-16-be-with-signature)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
422 '((safe-charsets
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
423 ascii
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
424 eight-bit-control
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
425 latin-iso8859-1
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
426 mule-unicode-0100-24ff
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
427 mule-unicode-2500-33ff
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
428 mule-unicode-e000-ffff)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
429 (coding-category . coding-category-utf-16-be)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
430 (mime-charset . utf-16)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
431 (valid-codes (0 . 255))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
432 (dependency unify-8859-on-encoding-mode
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
433 unify-8859-on-decoding-mode
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
434 utf-fragment-on-decoding
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
435 utf-translate-cjk)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
436 (post-read-conversion . mule-utf-16-post-read-conversion)))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
437 )
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
438
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
439 (define-coding-system-alias 'utf-16-le 'mule-utf-16-le)
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
440 (define-coding-system-alias 'utf-16-be 'mule-utf-16-be)
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
441 (define-coding-system-alias 'utf-16-le-with-signature
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
442 'mule-utf-16-le-with-signature)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
443 (define-coding-system-alias 'utf-16-be-with-signature
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
444 'mule-utf-16-be-with-signature)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
445 (define-coding-system-alias 'utf-16 'mule-utf-16)
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
446
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
447 ;;; utf-16.el ends here