annotate lisp/international/utf-16.el @ 52285:6c91b4a8b9af

Add mime-text-unsuitable coding system properties.
author Dave Love <fx@gnu.org>
date Wed, 20 Aug 2003 18:45:22 +0000
parents bc72d6855260
children 695cf19ef79e
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
52285
6c91b4a8b9af Add mime-text-unsuitable coding system
Dave Love <fx@gnu.org>
parents: 51631
diff changeset
3 ;; Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
46677
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
52285
6c91b4a8b9af Add mime-text-unsuitable coding system
Dave Love <fx@gnu.org>
parents: 51631
diff changeset
28 ;; surrogates) of Unicode, defined in RFC 2781. It is written either
6c91b4a8b9af Add mime-text-unsuitable coding system
Dave Love <fx@gnu.org>
parents: 51631
diff changeset
29 ;; in little or big endian order and either with or without the
6c91b4a8b9af Add mime-text-unsuitable coding system
Dave Love <fx@gnu.org>
parents: 51631
diff changeset
30 ;; leading BOM (a two-byte signature which identifies their byte sex).
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
31 ;;
52285
6c91b4a8b9af Add mime-text-unsuitable coding system
Dave Love <fx@gnu.org>
parents: 51631
diff changeset
32 ;; We provide these base coding systems.
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
33 ;; name endian BOM
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
34 ;; ---- ------ ---
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
35 ;; mule-utf-16le little no
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
36 ;; mule-utf-16be big no
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
37 ;; mule-utf-16le-with-signature little yes
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
38 ;; mule-utf-16be-with-signature big yes
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
39 ;; mule-utf-16 both yes
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
40 ;;
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
41 ;; Note that un-decodable sequences aren't (yet?) preserved as raw
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
42 ;; 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
43 ;; corrupt data.
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 ;;; Code:
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
46
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
47 ;; We end up with trivially different -le and -be versions of most
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
48 ;; things below, sometimes with commonality abstracted into a let
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
49 ;; binding for maintenance convenience.
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
50
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
51 ;; 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
52 ;; deal with untranslated sequences, since we can't otherwise
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
53 ;; distinguish the bytes, as we can with utf-8.
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
54
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
55 ;; ;; Do a multibyte write for bytes in r3 and r4.
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
56 ;; ;; Intended for untranslatable utf-16 sequences.
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
57 ;; (define-ccl-program ccl-mule-utf-16-untrans
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
58 ;; `(0
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
59 ;; (if (r3 < 128)
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
60 ;; (r0 = ,(charset-id 'ascii))
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
61 ;; (if (r3 < 160)
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
62 ;; (r0 = ,(charset-id 'eight-bit-control))
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
63 ;; (r0 = ,(charset-id 'eight-bit-graphic))))
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
64 ;; (if (r4 < 128)
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
65 ;; (r0 = ,(charset-id 'ascii))
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
66 ;; (if (r4 < 160)
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
67 ;; (r0 = ,(charset-id 'eight-bit-control))
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
68 ;; (r0 = ,(charset-id 'eight-bit-graphic))))
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
69 ;; (r1 = r4)))
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
70 ;; "Do a multibyte write for bytes in r3 and r4.
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
71 ;; First swap them if we're big endian, indicated by r5==0.
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
72 ;; Intended for untranslatable utf-16 sequences.")
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
73
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
74 ;; 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
75 (eval-and-compile
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
76 (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
77 ;; 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
78 ;; point in r1.
47705
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
79 `((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
80 (if r7 ; got a translation
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
81 ((r0 = r1) (r1 = r3))
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
82 (if (r1 < 128)
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
83 (r0 = ,(charset-id 'ascii))
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
84 (if (r1 < 160)
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
85 (r0 = ,(charset-id 'eight-bit-control))
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
86 (if (r1 < 256)
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
87 ((r0 = ,(charset-id 'latin-iso8859-1))
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
88 (r1 -= 128))
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
89 (if (r1 < #x2500)
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
90 ((r0 = ,(charset-id 'mule-unicode-0100-24ff))
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
91 (r1 -= #x100)
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 < #x3400)
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
96 ((r0 = ,(charset-id 'mule-unicode-2500-33ff))
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
97 (r1 -= #x2500)
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
98 (r2 = (((r1 / 96) + 32) << 7))
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
99 (r1 %= 96)
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
100 (r1 += (r2 + 32)))
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
101 (if (r1 < #xd800) ; 2 untranslated bytes
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
102 ;; ;; 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
103 ;; ;; overhead of the call.
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
104 ;; (call mule-utf-16-untrans)
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
105 ((r0 = ,(charset-id 'mule-unicode-e000-ffff))
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
106 (r1 = 15037)) ; U+fffd
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
107 (if (r1 < #xe000) ; surrogate
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
108 ;; ((call mule-utf-16-untrans)
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
109 ;; (write-multibyte-character r0 r1)
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
110 ;; (read r3 r4)
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
111 ;; (call mule-utf-16-untrans))
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
112 ((read r3 r4)
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
113 (r0 = ,(charset-id 'mule-unicode-e000-ffff))
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
114 (r1 = 15037))
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
115 ((r0 = ,(charset-id 'mule-unicode-e000-ffff))
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
116 (r1 -= #xe000)
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
117 (r2 = (((r1 / 96) + 32) << 7))
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
118 (r1 %= 96)
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
119 (r1 += (r2 + 32)))))))))))))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
120
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
121 (defconst utf-16le-decode-loop
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
122 `(loop
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
123 (read r3 r4)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
124 (r1 = (r4 <8 r3))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
125 ,utf-16-decode-ucs
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
126 (translate-character utf-translation-table-for-decode r0 r1)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
127 (write-multibyte-character r0 r1)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
128 (repeat)))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
129
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
130 (defconst utf-16be-decode-loop
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
131 `(loop
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
132 (read r3 r4)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
133 (r1 = (r3 <8 r4))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
134 ,@utf-16-decode-ucs
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
135 (translate-character utf-translation-table-for-decode r0 r1)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
136 (write-multibyte-character r0 r1)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
137 (repeat)))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
138
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
139 )
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
140
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
141 (define-ccl-program ccl-decode-mule-utf-16le
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
142 `(2 ; 2 bytes -> 1 to 4 bytes
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
143 ,utf-16le-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
144 "Decode UTF-16LE (little endian without signature bytes).
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
145 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
146 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
147 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
148 `utf-translation-table-for-decode'.")
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
149
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
150 (define-ccl-program ccl-decode-mule-utf-16be
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
151 `(2 ; 2 bytes -> 1 to 4 bytes
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
152 ,utf-16be-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
153 "Decode UTF-16BE (big endian without signature bytes).
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
154 Basic decoding is done into the charsets ascii, latin-iso8859-1 and
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
155 mule-unicode-*. Un-representable Unicode characters are
47705
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
156 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
157 name `utf-translation-table-for-decode'.")
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
158
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
159 (define-ccl-program ccl-decode-mule-utf-16le-with-signature
50483
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)
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
162 ,utf-16le-decode-loop))
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
163 "Like ccl-decode-utf-16le but skip the first 2-byte BOM.")
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
164
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
165 (define-ccl-program ccl-decode-mule-utf-16be-with-signature
50483
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)
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
168 ,utf-16be-decode-loop))
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
169 "Like ccl-decode-utf-16be but skip the first 2-byte BOM.")
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
170
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
171 (define-ccl-program ccl-decode-mule-utf-16
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
172 `(2
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
173 ((read r3 r4)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
174 (r1 = (r3 <8 r4))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
175 (if (r1 == #xFFFE)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
176 ;; 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
177 ;; is temporarily. It is removed by post-read-conversion
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
178 ;; function.
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
179 (,@utf-16-decode-ucs
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
180 (write-multibyte-character r0 r1)
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
181 ,utf-16le-decode-loop)
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
182 ((if (r1 == #xFEFF)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
183 ;; 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
184 ;; character in the output because it can't be
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
185 ;; distinguished with the normal U+FEFF. So, we keep
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
186 ;; #xFFFF instead.
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
187 ((r1 = #xFFFF)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
188 ,@utf-16-decode-ucs)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
189 ;; R1 a normal Unicode character.
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
190 (,@utf-16-decode-ucs
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
191 (translate-character utf-translation-table-for-decode r0 r1)))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
192 (write-multibyte-character r0 r1)
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
193 ,utf-16be-decode-loop))))
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
194 "Like ccl-decode-utf-16be/le but check the first BOM.")
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
195
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
196 (makunbound 'utf-16-decode-ucs) ; done with it
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
197 (makunbound 'utf-16le-decode-loop)
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
198 (makunbound 'utf-16be-decode-loop)
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
199
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
200 (eval-and-compile
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
201 (defconst utf-16-decode-to-ucs
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
202 ;; 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
203 ;; 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
204 ;; basic utf-8 coding system ones. Otherwise set to U+fffd.
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
205 `(if (r0 == ,(charset-id 'ascii))
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 (if (r0 == ,(charset-id 'latin-iso8859-1))
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
208 (r0 = (r1 + 128))
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
209 (if (r0 == ,(charset-id 'eight-bit-control))
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
210 (r0 = r1)
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
211 (if (r0 == ,(charset-id 'eight-bit-graphic))
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
212 (r0 = r1)
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
213 ((r2 = (r1 & #x7f))
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
214 (r1 >>= 7)
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
215 (r3 = ((r1 - 32) * 96))
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
216 (r3 += (r2 - 32))
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
217 (if (r0 == ,(charset-id 'mule-unicode-0100-24ff))
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
218 (r0 = (r3 + #x100))
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
219 (if (r0 == ,(charset-id 'mule-unicode-2500-33ff))
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
220 (r0 = (r3 + #x2500))
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
221 (if (r0 == ,(charset-id 'mule-unicode-e000-ffff))
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
222 (r0 = (r3 + #xe000))
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
223 (r0 = #xfffd))))))))))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
224
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
225 (defconst utf-16le-encode-loop
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
226 `(loop
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
227 (read-multibyte-character r0 r1)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
228 (lookup-character utf-subst-table-for-encode r0 r1)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
229 (if (r7 == 0)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
230 ((translate-character utf-translation-table-for-encode r0 r1)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
231 ,utf-16-decode-to-ucs))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
232 (write (r0 & 255))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
233 (write (r0 >> 8))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
234 (repeat)))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
235
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
236 (defconst utf-16be-encode-loop
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
237 `(loop
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
238 (read-multibyte-character r0 r1)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
239 (lookup-character utf-subst-table-for-encode r0 r1)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
240 (if (r7 == 0)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
241 ((translate-character utf-translation-table-for-encode r0 r1)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
242 ,utf-16-decode-to-ucs))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
243 (write (r0 >> 8))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
244 (write (r0 & 255))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
245 (repeat)))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
246 )
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
247
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
248
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
249 (define-ccl-program ccl-encode-mule-utf-16le
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
250 `(1
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
251 ,utf-16le-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
252 "Encode to UTF-16LE (little endian without signature).
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
253 Characters from the charsets ascii, eight-bit-control,
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
254 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
255 after translation through the translation-table of name
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
256 `utf-translation-table-for-encode'.
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
257 Others are encoded as U+FFFD.")
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
258
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
259 (define-ccl-program ccl-encode-mule-utf-16be
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
260 `(1
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
261 ,utf-16be-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
262 "Encode to UTF-16BE (big endian without signature).
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
263 Characters from the charsets ascii, eight-bit-control,
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
264 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
265 after translation through the translation-table named
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
266 `utf-translation-table-for-encode'.
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
267 Others are encoded as U+FFFD.")
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
268
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
269 (define-ccl-program ccl-encode-mule-utf-16le-with-signature
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
270 `(1
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
271 ((write #xFF)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
272 (write #xFE)
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
273 ,utf-16le-encode-loop))
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
274 "Encode to UTF-16 (little endian with signature).
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
275 Characters from the charsets ascii, eight-bit-control,
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
276 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
277 after translation through the translation-table of name
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
278 `utf-translation-table-for-encode'.
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
279 Others are encoded as U+FFFD.")
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
280
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
281 (define-ccl-program ccl-encode-mule-utf-16be-with-signature
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
282 `(1
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
283 ((write #xFE)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
284 (write #xFF)
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
285 ,utf-16be-encode-loop))
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
286 "Encode to UTF-16 (big endian with signature).
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
287 Characters from the charsets ascii, eight-bit-control,
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
288 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
289 after translation through the translation-table named
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
290 `utf-translation-table-for-encode'.
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
291 Others are encoded as U+FFFD.")
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
292
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
293 (makunbound 'utf-16-decode-to-ucs)
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
294 (makunbound 'utf-16le-encode-loop)
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
295 (makunbound 'utf-16be-encode-loop)
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
296
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
297 (defun mule-utf-16-post-read-conversion (length)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
298 (when (> length 0)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
299 (let ((char (following-char)))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
300 (cond ((= char (decode-char 'ucs #xFFFE))
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
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
305 'mule-utf-16le-with-signature))
50483
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 ((= char (decode-char 'ucs #xFFFF))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
308 (delete-char 1)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
309 (setq last-coding-system-used
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
310 (coding-system-change-text-conversion
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
311 last-coding-system-used
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
312 'mule-utf-16be-with-signature))
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
313 (setq length (1- length)))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
314 (t
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
315 (setq last-coding-system-used 'mule-utf-16be)))))
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
316 length)
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
317
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
318 (let ((doc "
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
319
47705
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
320 It supports Unicode characters of these ranges:
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
321 U+0000..U+33FF, U+E000..U+FFFF.
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
322 They correspond to these Emacs character sets:
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
323 ascii, latin-iso8859-1, mule-unicode-0100-24ff,
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
324 mule-unicode-2500-33ff, mule-unicode-e000-ffff
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
325
47705
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
326 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
327 ranges are decoded as U+FFFD, effectively corrupting the data
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49203
diff changeset
328 if they are re-encoded.
47705
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
329
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
330 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
331 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
332 sequence representing U+FFFD (REPLACEMENT CHARACTER)."))
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
333 (make-coding-system
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
334 'mule-utf-16le 4
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
335 ?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
336 (concat
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
337 "UTF-16LE encoding for Emacs-supported Unicode characters."
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
338 doc)
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
339
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
340 '(ccl-decode-mule-utf-16le . ccl-encode-mule-utf-16le)
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
341 '((safe-charsets
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
342 ascii
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
343 eight-bit-control
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
344 latin-iso8859-1
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
345 mule-unicode-0100-24ff
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
346 mule-unicode-2500-33ff
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
347 mule-unicode-e000-ffff)
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
348 (mime-charset . utf-16le)
52285
6c91b4a8b9af Add mime-text-unsuitable coding system
Dave Love <fx@gnu.org>
parents: 51631
diff changeset
349 (mime-text-unsuitable . t)
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
350 (valid-codes (0 . 255))
47705
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
351 (dependency unify-8859-on-encoding-mode
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
352 unify-8859-on-decoding-mode
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
353 utf-fragment-on-decoding
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
354 utf-translate-cjk)))
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
355
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
356 (make-coding-system
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
357 'mule-utf-16be 4 ?u
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
358 (concat
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
359 "UTF-16BE encoding for Emacs-supported Unicode characters."
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
360 doc)
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
361
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
362 '(ccl-decode-mule-utf-16be . ccl-encode-mule-utf-16be)
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
363 '((safe-charsets
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
364 ascii
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
365 eight-bit-control
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
366 latin-iso8859-1
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
367 mule-unicode-0100-24ff
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
368 mule-unicode-2500-33ff
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
369 mule-unicode-e000-ffff)
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
370 (mime-charset . utf-16be)
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
371 (valid-codes (0 . 255))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
372 (dependency unify-8859-on-encoding-mode
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
373 unify-8859-on-decoding-mode
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
374 utf-fragment-on-decoding
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
375 utf-translate-cjk)))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
376
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
377 (make-coding-system
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
378 'mule-utf-16le-with-signature 4 ?u
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
379 (concat
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
380 "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
381 doc)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
382
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
383 '(ccl-decode-mule-utf-16le-with-signature
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
384 . ccl-encode-mule-utf-16le-with-signature)
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
385 '((safe-charsets
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
386 ascii
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
387 eight-bit-control
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
388 latin-iso8859-1
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
389 mule-unicode-0100-24ff
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
390 mule-unicode-2500-33ff
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
391 mule-unicode-e000-ffff)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
392 (coding-category . coding-category-utf-16-le)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
393 (mime-charset . utf-16)
52285
6c91b4a8b9af Add mime-text-unsuitable coding system
Dave Love <fx@gnu.org>
parents: 51631
diff changeset
394 (mime-text-unsuitable . t)
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
395 (valid-codes (0 . 255))
47705
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
396 (dependency unify-8859-on-encoding-mode
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
397 unify-8859-on-decoding-mode
797c350a7f8c (utf-16-decode-ucs): Look up
Kenichi Handa <handa@m17n.org>
parents: 47384
diff changeset
398 utf-fragment-on-decoding
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
399 utf-translate-cjk)))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
400
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
401 (make-coding-system
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
402 'mule-utf-16be-with-signature 4 ?u
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
403 (concat
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
404 "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
405 doc)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
406
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
407 '(ccl-decode-mule-utf-16be-with-signature
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
408 . ccl-encode-mule-utf-16be-with-signature)
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
409 '((safe-charsets
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
410 ascii
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
411 eight-bit-control
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
412 latin-iso8859-1
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
413 mule-unicode-0100-24ff
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
414 mule-unicode-2500-33ff
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
415 mule-unicode-e000-ffff)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
416 (coding-category . coding-category-utf-16-be)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
417 (mime-charset . utf-16)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
418 (valid-codes (0 . 255))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
419 (dependency unify-8859-on-encoding-mode
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
420 unify-8859-on-decoding-mode
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
421 utf-fragment-on-decoding
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
422 utf-translate-cjk)))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
423
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
424 (make-coding-system
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
425 'mule-utf-16 4 ?u
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
426 (concat
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
427 "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
428 doc)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
429
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
430 '(ccl-decode-mule-utf-16 . ccl-encode-mule-utf-16be-with-signature)
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
431 '((safe-charsets
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
432 ascii
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
433 eight-bit-control
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
434 latin-iso8859-1
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
435 mule-unicode-0100-24ff
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
436 mule-unicode-2500-33ff
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
437 mule-unicode-e000-ffff)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
438 (coding-category . coding-category-utf-16-be)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
439 (mime-charset . utf-16)
52285
6c91b4a8b9af Add mime-text-unsuitable coding system
Dave Love <fx@gnu.org>
parents: 51631
diff changeset
440 (mime-text-unsuitable . t)
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
441 (valid-codes (0 . 255))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
442 (dependency unify-8859-on-encoding-mode
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
443 unify-8859-on-decoding-mode
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
444 utf-fragment-on-decoding
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
445 utf-translate-cjk)
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
446 (post-read-conversion . mule-utf-16-post-read-conversion)))
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
447 )
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
448
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
449 (define-coding-system-alias 'utf-16le 'mule-utf-16le)
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
450 (define-coding-system-alias 'utf-16be 'mule-utf-16be)
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
451 (define-coding-system-alias 'utf-16le-with-signature
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
452 'mule-utf-16le-with-signature)
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
453 (define-coding-system-alias 'utf-16be-with-signature
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
454 'mule-utf-16be-with-signature)
50483
15382232cf57 (utf-16-le-decode-loop)
Kenichi Handa <handa@m17n.org>
parents: 50349
diff changeset
455 (define-coding-system-alias 'utf-16 'mule-utf-16)
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
456
51631
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
457 ;; For backward compatibility.
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
458 (define-coding-system-alias 'mule-utf-16-le 'mule-utf-16le-with-signature)
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
459 (define-coding-system-alias 'utf-16-le 'mule-utf-16le-with-signature)
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
460 (define-coding-system-alias 'mule-utf-16-be 'mule-utf-16be-with-signature)
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
461 (define-coding-system-alias 'utf-16-be 'mule-utf-16be-with-signature)
bc72d6855260 Many name changes: utf-16-{be,le} -> utf-16{be,le}.
Kenichi Handa <handa@m17n.org>
parents: 50483
diff changeset
462
46677
86e8d59e2e49 *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
463 ;;; utf-16.el ends here