1 |
wakaba |
1.1 |
=head1 NAME |
2 |
|
|
|
3 |
|
|
Encode::ISO2022::SevenBit --- Encode and decode of 7-bit ISO/IEC 2022 |
4 |
|
|
based encodings |
5 |
|
|
|
6 |
|
|
=head1 ENCODINGS |
7 |
|
|
|
8 |
|
|
=over 4 |
9 |
|
|
|
10 |
|
|
=cut |
11 |
|
|
|
12 |
|
|
require 5.7.3; |
13 |
|
|
use strict; |
14 |
|
|
package Encode::ISO2022::SevenBit; |
15 |
|
|
use vars qw($VERSION); |
16 |
|
|
$VERSION=do{my @r=(q$Revision: 1.1 $=~/\d+/g);sprintf "%d."."%02d" x $#r,@r}; |
17 |
|
|
use base qw(Encode::Encoding); |
18 |
|
|
__PACKAGE__->Define (qw/iso-2022-7bit jis junet/); |
19 |
|
|
require Encode::ISO2022; |
20 |
|
|
|
21 |
|
|
sub encode ($$;$) { |
22 |
|
|
my ($obj, $str, $chk) = @_; |
23 |
|
|
$_[1] = '' if $chk; |
24 |
|
|
$str = &Encode::ISO2022::internal_to_iso2022 ($str, $obj->__2022_encode); |
25 |
|
|
return $str; |
26 |
|
|
} |
27 |
|
|
|
28 |
|
|
sub decode ($$;$) { |
29 |
|
|
my ($obj, $str, $chk) = @_; |
30 |
|
|
$_[1] = '' if $chk; |
31 |
|
|
return &Encode::ISO2022::iso2022_to_internal ($str, $obj->__2022_decode); |
32 |
|
|
} |
33 |
|
|
|
34 |
|
|
=item iso-2022-7bit |
35 |
|
|
|
36 |
|
|
ISO/IEC 2022 based 7-bit encoding using only G0 |
37 |
|
|
(Alias: junet, jis) |
38 |
|
|
|
39 |
|
|
=cut |
40 |
|
|
|
41 |
|
|
sub __2022__common ($) { |
42 |
|
|
my $C = Encode::ISO2022->new_object; |
43 |
|
|
$C->{bit} = 7; |
44 |
|
|
$C->{option}->{designate_to}->{G96}->{default} = 0; |
45 |
|
|
$C->{option}->{designate_to}->{G96n}->{default} = 0; |
46 |
|
|
$C; |
47 |
|
|
} |
48 |
|
|
sub __2022_encode ($) { |
49 |
|
|
my $C = shift->__2022__common; |
50 |
|
|
$C->{G1} = $Encode::ISO2022::CHARSET{G96}->{"\x7E"}; ## empty set |
51 |
|
|
$C; |
52 |
|
|
} |
53 |
|
|
sub __2022_decode ($) { |
54 |
|
|
my $C = shift->__2022__common; |
55 |
|
|
|
56 |
|
|
$C; |
57 |
|
|
} |
58 |
|
|
|
59 |
|
|
package Encode::ISO2022::SevenBit::JP; |
60 |
|
|
use vars qw/@ISA/; |
61 |
|
|
push @ISA, 'Encode::ISO2022::SevenBit'; |
62 |
|
|
__PACKAGE__->Define (qw/iso-2022-jp junet-code japanese-iso-7bit/); |
63 |
|
|
|
64 |
|
|
=item iso-2022-jp |
65 |
|
|
|
66 |
|
|
ISO/IEC 2022 based 7-bit encoding for Japanese. |
67 |
|
|
Defined by Junet no tebiki, RFC 1468 and JIS X 0208:1997 Appendix 2. |
68 |
|
|
(Alias: junet-code, japanese-iso-7bit (emacsen)) |
69 |
|
|
|
70 |
|
|
=cut |
71 |
|
|
|
72 |
|
|
sub __2022__common ($) { |
73 |
|
|
my $C = Encode::ISO2022->new_object; |
74 |
|
|
$C->{bit} = 7; |
75 |
|
|
$C->{option}->{designate_to}->{C0}->{default} = -1; |
76 |
|
|
$C->{option}->{designate_to}->{C0}->{"\x40"} = 0; |
77 |
|
|
$C->{option}->{designate_to}->{C1}->{default} = -1; |
78 |
|
|
$C->{option}->{designate_to}->{G94}->{default} = -1; |
79 |
|
|
$C->{option}->{designate_to}->{G94n}->{default} = -1; |
80 |
|
|
$C->{option}->{designate_to}->{G96}->{default} = -1; |
81 |
|
|
$C->{option}->{designate_to}->{G96n}->{default} = -1; |
82 |
|
|
$C->{option}->{designate_to}->{G94}->{"\x4A"} = 0; ## JIS X 0201 roman |
83 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x40"} = 0; ## JIS X 0208-1978 |
84 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x42"} = 0; ## JIS X 0208-1983 |
85 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x42\x40"} = 0; ## JIS X 0208-1990 |
86 |
|
|
$C->{option}->{use_revision} = 0; |
87 |
|
|
$C; |
88 |
|
|
} |
89 |
|
|
sub __2022_encode ($) { |
90 |
|
|
my $C = shift->__2022__common; |
91 |
|
|
$C->{C1} = $Encode::ISO2022::CHARSET{C1}->{"\x7E"}; ## empty set |
92 |
|
|
$C->{G1} = $Encode::ISO2022::CHARSET{G96}->{"\x7E"}; ## empty set |
93 |
|
|
$C; |
94 |
|
|
} |
95 |
|
|
|
96 |
|
|
package Encode::ISO2022::SevenBit::JP1978IRV; |
97 |
|
|
use vars qw/@ISA/; |
98 |
|
|
push @ISA, 'Encode::ISO2022::SevenBit::JP'; |
99 |
|
|
__PACKAGE__->Define (qw/iso-2022-jp-1978-irv japanese-iso-7bit-1978-irv old-jis/); |
100 |
|
|
|
101 |
|
|
=item iso-2022-jp-1978-irv |
102 |
|
|
|
103 |
|
|
ISO/IEC 2022 based 7-bit encoding for Japanese. |
104 |
|
|
(Alias: japanese-iso-7bit-1978-irv (emacsen), old-jis (emacsen)) |
105 |
|
|
|
106 |
|
|
=cut |
107 |
|
|
|
108 |
|
|
sub __2022_encode ($) { |
109 |
|
|
my $C = shift->__2022__common; |
110 |
|
|
$C->{option}->{designate_to}->{G94}->{"\x4A"} = -1; ## JIS X 0201 roman |
111 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x42"} = -1; ## JIS X 0208-1983 |
112 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x42\x40"} = -1; ## JIS X 0208-1990 |
113 |
|
|
$C; |
114 |
|
|
} |
115 |
|
|
|
116 |
|
|
package Encode::ISO2022::SevenBit::JP1; |
117 |
|
|
use vars qw/@ISA/; |
118 |
|
|
push @ISA, 'Encode::ISO2022::SevenBit::JP'; |
119 |
|
|
__PACKAGE__->Define (qw/iso-2022-jp-1/); |
120 |
|
|
|
121 |
|
|
=item iso-2022-jp-1 |
122 |
|
|
|
123 |
|
|
ISO/IEC 2022 based 7-bit encoding for Japanese, |
124 |
|
|
defined by RFC 2237 |
125 |
|
|
|
126 |
|
|
=cut |
127 |
|
|
|
128 |
|
|
sub __2022__common ($) { |
129 |
|
|
my $C = shift->SUPER::__2022__common; |
130 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x44"} = 0; ## JIS X 0212-1990 |
131 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x42\x40"} = -1; ## JIS X 0208-1990 |
132 |
|
|
$C; |
133 |
|
|
} |
134 |
|
|
|
135 |
|
|
package Encode::ISO2022::SevenBit::JP3; |
136 |
|
|
use vars qw/@ISA/; |
137 |
|
|
push @ISA, 'Encode::ISO2022::SevenBit::JP'; |
138 |
|
|
__PACKAGE__->Define (qw/iso-2022-jp-3 x-iso-2022-jp-3 iso-2022-jp-3-compatible iso-2022-jp-3-strict/); |
139 |
|
|
|
140 |
|
|
=item iso-2022-jp-3 |
141 |
|
|
|
142 |
|
|
ISO/IEC 2022 based 7-bit encoding for Japanese, |
143 |
|
|
defined by JIS X 0213:2000 Appendix 2. |
144 |
|
|
(Alias: x-iso-2022-jp-3) |
145 |
|
|
|
146 |
|
|
=item iso-2022-jp-3-compatible |
147 |
|
|
|
148 |
|
|
ISO/IEC 2022 based 7-bit encoding for Japanese |
149 |
|
|
|
150 |
|
|
=item iso-2022-jp-3-strict |
151 |
|
|
|
152 |
|
|
ISO/IEC 2022 based 7-bit encoding for Japanese. |
153 |
|
|
A subset of iso-2022-jp-3. |
154 |
|
|
|
155 |
|
|
=cut |
156 |
|
|
|
157 |
|
|
sub __2022__common ($) { |
158 |
|
|
my $C = shift->SUPER::__2022__common; |
159 |
|
|
$C->{option}->{designate_to}->{G94}->{"\x4A"} = -1; ## JIS X 0201 roman |
160 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x40"} = -1; ## JIS X 0208-1978 |
161 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x42"} = 0; ## restricted JIS X 0213:2000 plane 1 |
162 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x42\x40"} = -1; ## JIS X 0208-1990 |
163 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x4F"} = 0; ## JIS X 0213:2000 plane 1 |
164 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x50"} = 0; ## JIS X 0213:2000 plane 2 |
165 |
|
|
$C; |
166 |
|
|
} |
167 |
|
|
|
168 |
|
|
package Encode::ISO2022::SevenBit::JP3Plane1; |
169 |
|
|
use vars qw/@ISA/; |
170 |
|
|
push @ISA, 'Encode::ISO2022::SevenBit::JP3'; |
171 |
|
|
__PACKAGE__->Define (qw/iso-2022-jp-3-plane1/); |
172 |
|
|
|
173 |
|
|
=item iso-2022-jp-3-plane1 |
174 |
|
|
|
175 |
|
|
ISO/IEC 2022 based 7-bit encoding for Japanese, |
176 |
|
|
defined by JIS X 0213:2000 Appendix 2. |
177 |
|
|
|
178 |
|
|
=cut |
179 |
|
|
|
180 |
|
|
sub __2022__common ($) { |
181 |
|
|
my $C = shift->SUPER::__2022__common; |
182 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x50"} = -1; ## JIS X 0213:2000 plane 2 |
183 |
|
|
$C; |
184 |
|
|
} |
185 |
|
|
|
186 |
|
|
package Encode::ISO2022::SevenBit::SS2; |
187 |
|
|
use vars qw/@ISA/; |
188 |
|
|
push @ISA, 'Encode::ISO2022::SevenBit'; |
189 |
|
|
__PACKAGE__->Define (qw/iso-2022-7bit-ss2 x-iso-2022-jp-2/); |
190 |
|
|
|
191 |
|
|
=item iso-2022-7bit-ss2 |
192 |
|
|
|
193 |
|
|
ISO/IEC 2022 based 7-bit encoding using SS2 for 96-charset |
194 |
|
|
(Alias: x-iso-2022-jp-2) |
195 |
|
|
|
196 |
|
|
=cut |
197 |
|
|
|
198 |
|
|
sub __2022__common ($) { |
199 |
|
|
my $C = shift->SUPER::__2022__common; |
200 |
|
|
$C->{option}->{designate_to}->{G96}->{default} = 2; |
201 |
|
|
$C->{option}->{designate_to}->{G96n}->{default} = 2; |
202 |
|
|
$C->{option}->{Ginvoke_by_single_shift}->[2] = 1; |
203 |
|
|
$C; |
204 |
|
|
} |
205 |
|
|
|
206 |
|
|
package Encode::ISO2022::SevenBit::JP2; |
207 |
|
|
use vars qw/@ISA/; |
208 |
|
|
push @ISA, 'Encode::ISO2022::SevenBit::SS2'; |
209 |
|
|
__PACKAGE__->Define (qw/iso-2022-jp-2/); |
210 |
|
|
|
211 |
|
|
=item iso-2022-jp-2 |
212 |
|
|
|
213 |
|
|
ISO/IEC 2022 based 7-bit multilingual encoding, defined by |
214 |
|
|
RFC 1554. A subset of iso-2022-7bit-ss2. |
215 |
|
|
|
216 |
|
|
=cut |
217 |
|
|
|
218 |
|
|
sub __2022__common ($) { |
219 |
|
|
my $C = shift->SUPER::__2022__common; |
220 |
|
|
$C->{option}->{designate_to}->{C0}->{default} = -1; |
221 |
|
|
$C->{option}->{designate_to}->{C0}->{"\x40"} = 0; |
222 |
|
|
$C->{option}->{designate_to}->{C1}->{default} = -1; |
223 |
|
|
$C->{C1} = $Encode::ISO2022::CHARSET{C1}->{"\x47"}; ## Minimum C1 |
224 |
|
|
$C->{option}->{designate_to}->{C1}->{"\x47"} = 1; |
225 |
|
|
$C->{option}->{designate_to}->{G94}->{default} = -1; |
226 |
|
|
$C->{option}->{designate_to}->{G94n}->{default} = -1; |
227 |
|
|
$C->{option}->{designate_to}->{G96}->{default} = -1; |
228 |
|
|
$C->{option}->{designate_to}->{G96n}->{default} = -1; |
229 |
|
|
$C->{option}->{designate_to}->{G94}->{"\x4A"} = 0; ## JIS X 0201 roman |
230 |
|
|
for ("\x40", "\x41", "\x42", "\x43") { |
231 |
|
|
$C->{option}->{designate_to}->{G94n}->{ $_ } = 0; |
232 |
|
|
} |
233 |
|
|
for ("\x41", "\x46") { |
234 |
|
|
$C->{option}->{designate_to}->{G96}->{ $_ } = 2; |
235 |
|
|
} |
236 |
|
|
$C; |
237 |
|
|
} |
238 |
|
|
sub __2022_encode ($) { |
239 |
|
|
my $C = shift->__2022__common; |
240 |
|
|
$C->{C1} = $Encode::ISO2022::CHARSET{C1}->{"\x7E"}; ## empty set |
241 |
|
|
$C->{G1} = $Encode::ISO2022::CHARSET{G96}->{"\x7E"}; ## empty set |
242 |
|
|
$C; |
243 |
|
|
} |
244 |
|
|
|
245 |
|
|
package Encode::ISO2022::SevenBit::Lock; |
246 |
|
|
use vars qw/@ISA/; |
247 |
|
|
push @ISA, 'Encode::ISO2022::SevenBit'; |
248 |
|
|
__PACKAGE__->Define (qw/iso-2022-7bit-lock/); |
249 |
|
|
|
250 |
|
|
=item iso-2022-7bit-lock |
251 |
|
|
|
252 |
|
|
ISO/IEC 2022 based 7-bit encoding using G1 and locking-shift for 96-charset |
253 |
|
|
|
254 |
|
|
=cut |
255 |
|
|
|
256 |
|
|
sub __2022__common ($) { |
257 |
|
|
my $C = shift->SUPER::__2022__common; |
258 |
|
|
$C->{option}->{designate_to}->{G96}->{default} = 1; |
259 |
|
|
$C->{option}->{designate_to}->{G96n}->{default} = 1; |
260 |
|
|
$C; |
261 |
|
|
} |
262 |
|
|
|
263 |
|
|
package Encode::ISO2022::SevenBit::KR; |
264 |
|
|
use vars qw/@ISA/; |
265 |
|
|
push @ISA, 'Encode::ISO2022::SevenBit'; |
266 |
|
|
__PACKAGE__->Define (qw/iso-2022-kr korean-iso-7bit/); |
267 |
|
|
|
268 |
|
|
=item iso-2022-kr |
269 |
|
|
|
270 |
|
|
An ISO/IEC 2022 based 7-bit encoding for Korean, |
271 |
|
|
defined by RFC 1557 (Alias: korean-iso-7bit (emacsen)) |
272 |
|
|
|
273 |
|
|
=cut |
274 |
|
|
|
275 |
|
|
sub __2022__common ($) { |
276 |
|
|
my $C = shift->SUPER::__2022__common; |
277 |
|
|
$C->{option}->{designate_to}->{C0}->{default} = -1; |
278 |
|
|
$C->{option}->{designate_to}->{C0}->{"\x40"} = 0; |
279 |
|
|
$C->{option}->{designate_to}->{C1}->{default} = -1; |
280 |
|
|
$C->{option}->{designate_to}->{G94}->{default} = -1; |
281 |
|
|
$C->{option}->{designate_to}->{G94n}->{default} = -1; |
282 |
|
|
$C->{option}->{designate_to}->{G96}->{default} = -1; |
283 |
|
|
$C->{option}->{designate_to}->{G96n}->{default} = -1; |
284 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x43"} = 1; ## KS X 1001 |
285 |
|
|
$C; |
286 |
|
|
} |
287 |
|
|
sub __2022_encode ($) { |
288 |
|
|
my $C = shift->__2022__common; |
289 |
|
|
$C->{C1} = $Encode::ISO2022::CHARSET{C1}->{"\x7E"}; ## empty set |
290 |
|
|
$C->{G1} = $Encode::ISO2022::CHARSET{G96}->{"\x7E"}; ## empty set |
291 |
|
|
$C; |
292 |
|
|
} |
293 |
|
|
sub __2022_decode ($) { |
294 |
|
|
my $C = shift->__2022__common; |
295 |
|
|
$C->{G1} = $Encode::ISO2022::CHARSET{G94n}->{"\x43"}; ## KS X 1001 |
296 |
|
|
$C; |
297 |
|
|
} |
298 |
|
|
|
299 |
|
|
package Encode::ISO2022::SevenBit::INT1; |
300 |
|
|
use vars qw/@ISA/; |
301 |
|
|
push @ISA, 'Encode::ISO2022::SevenBit'; |
302 |
|
|
__PACKAGE__->Define (qw/iso-2022-int-1/); |
303 |
|
|
|
304 |
|
|
=item iso-2022-int-1 |
305 |
|
|
|
306 |
|
|
An ISO/IEC 2022 based 7-bit multilingual encoding, |
307 |
|
|
defined by draft-ohta-text-encoding |
308 |
|
|
|
309 |
|
|
=cut |
310 |
|
|
|
311 |
|
|
sub __2022__common ($) { |
312 |
|
|
my $C = shift->SUPER::__2022__common; |
313 |
|
|
$C->{option}->{designate_to}->{C0}->{default} = -1; |
314 |
|
|
$C->{option}->{designate_to}->{C0}->{"\x40"} = 0; |
315 |
|
|
$C->{option}->{designate_to}->{C1}->{default} = -1; |
316 |
|
|
$C->{option}->{designate_to}->{G94}->{default} = -1; |
317 |
|
|
$C->{option}->{designate_to}->{G94n}->{default} = -1; |
318 |
|
|
$C->{option}->{designate_to}->{G96}->{default} = -1; |
319 |
|
|
$C->{option}->{designate_to}->{G96n}->{default} = -1; |
320 |
|
|
$C->{option}->{designate_to}->{G94}->{"\x4A"} = 0; ## JIS X 0201 roman |
321 |
|
|
for ("\x40", "\x41", "\x42") { |
322 |
|
|
$C->{option}->{designate_to}->{G94n}->{ $_ } = 0; |
323 |
|
|
} |
324 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x43"} = 1; ## KS X 1001 |
325 |
|
|
for ("\x41", "\x46") { ## ISO/IEC 8859-1,7 |
326 |
|
|
$C->{option}->{designate_to}->{G96}->{ $_ } = 1; |
327 |
|
|
} |
328 |
|
|
$C; |
329 |
|
|
} |
330 |
|
|
sub __2022_encode ($) { |
331 |
|
|
my $C = shift->__2022__common; |
332 |
|
|
$C->{C1} = $Encode::ISO2022::CHARSET{C1}->{"\x7E"}; ## empty set |
333 |
|
|
$C->{G1} = $Encode::ISO2022::CHARSET{G96}->{"\x7E"}; ## empty set |
334 |
|
|
$C; |
335 |
|
|
} |
336 |
|
|
sub __2022_decode ($) { |
337 |
|
|
my $C = shift->__2022__common; |
338 |
|
|
$C->{G1} = $Encode::ISO2022::CHARSET{G94n}->{"\x43"}; ## KS X 1001 |
339 |
|
|
$C; |
340 |
|
|
} |
341 |
|
|
|
342 |
|
|
package Encode::ISO2022::SevenBit::LockSS2; |
343 |
|
|
use vars qw/@ISA/; |
344 |
|
|
push @ISA, 'Encode::ISO2022::SevenBit'; |
345 |
|
|
__PACKAGE__->Define (qw/iso-2022-7bit-lock-ss2 iso-2022-cjk/); |
346 |
|
|
|
347 |
|
|
=item iso-2022-7bit-lock-ss2 |
348 |
|
|
|
349 |
|
|
An ISO/IEC 2022 based 7-bit encoding. Mixture of ISO-2022-JP, |
350 |
|
|
ISO-2022-KR, ISO-2022-CN. (Alias: iso-2022-cjk (emacsen)) |
351 |
|
|
|
352 |
|
|
=cut |
353 |
|
|
|
354 |
|
|
sub __2022__common ($) { |
355 |
|
|
my $C = shift->SUPER::__2022__common; |
356 |
|
|
$C->{option}->{designate_to}->{G96}->{default} = 2; |
357 |
|
|
$C->{option}->{designate_to}->{G96n}->{default} = 2; |
358 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x41"} = 1; ## GB 2312 |
359 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x43"} = 1; ## KS X 1001 |
360 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x45"} = 1; ## ISO-IR 165 |
361 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x47"} = 1; ## CNS 11643 plane 1 |
362 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x48"} = 2; ## CNS 11643 plane 2 |
363 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x49"} = 3; ## CNS 11643 plane 3 |
364 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x4A"} = 3; ## CNS 11643 plane 4 |
365 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x4B"} = 3; ## CNS 11643 plane 5 |
366 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x4C"} = 3; ## CNS 11643 plane 6 |
367 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x4D"} = 3; ## CNS 11643 plane 7 |
368 |
|
|
$C; |
369 |
|
|
} |
370 |
|
|
sub __2022_decode ($) { |
371 |
|
|
my $C = shift->__2022__common; |
372 |
|
|
$C->{G1} = $Encode::ISO2022::CHARSET{G94n}->{"\x43"}; ## KS X 1001 |
373 |
|
|
$C; |
374 |
|
|
} |
375 |
|
|
|
376 |
|
|
package Encode::ISO2022::SevenBit::CN; |
377 |
|
|
use vars qw/@ISA/; |
378 |
|
|
push @ISA, 'Encode::ISO2022::SevenBit'; |
379 |
|
|
__PACKAGE__->Define (qw/iso-2022-cn chinese-iso-7bit/); |
380 |
|
|
|
381 |
|
|
=item iso-2022-cn |
382 |
|
|
|
383 |
|
|
An ISO/IEC 2022 based 7-bit encoding for Chinese, |
384 |
|
|
defined by RFC 1922 (Alias: chinese-iso-7bit (emacsen)) |
385 |
|
|
|
386 |
|
|
=cut |
387 |
|
|
|
388 |
|
|
sub __2022__common ($) { |
389 |
|
|
my $C = shift->SUPER::__2022__common; |
390 |
|
|
$C->{option}->{designate_to}->{C0}->{default} = -1; |
391 |
|
|
$C->{option}->{designate_to}->{C0}->{"\x40"} = 0; |
392 |
|
|
$C->{option}->{designate_to}->{C1}->{default} = -1; |
393 |
|
|
$C->{option}->{designate_to}->{G94}->{default} = -1; |
394 |
|
|
$C->{option}->{designate_to}->{G94n}->{default} = -1; |
395 |
|
|
$C->{option}->{designate_to}->{G96}->{default} = -1; |
396 |
|
|
$C->{option}->{designate_to}->{G96n}->{default} = -1; |
397 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x41"} = 1; ## GB 2312 |
398 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x47"} = 1; ## CNS 11643 plane 1 |
399 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x48"} = 2; ## CNS 11643 plane 2 |
400 |
|
|
$C; |
401 |
|
|
} |
402 |
|
|
sub __2022_encode ($) { |
403 |
|
|
my $C = shift->__2022__common; |
404 |
|
|
$C->{C1} = $Encode::ISO2022::CHARSET{C1}->{"\x7E"}; ## empty set |
405 |
|
|
$C->{G1} = $Encode::ISO2022::CHARSET{G96}->{"\x7E"}; ## empty set |
406 |
|
|
$C; |
407 |
|
|
} |
408 |
|
|
|
409 |
|
|
package Encode::ISO2022::SevenBit::CNExt; |
410 |
|
|
use vars qw/@ISA/; |
411 |
|
|
push @ISA, 'Encode::ISO2022::SevenBit::CN'; |
412 |
|
|
__PACKAGE__->Define (qw/iso-2022-cn-ext/); |
413 |
|
|
|
414 |
|
|
=item iso-2022-cn-ext |
415 |
|
|
|
416 |
|
|
An ISO/IEC 2022 based 7-bit encoding for Chinese, |
417 |
|
|
defined by RFC 1922 |
418 |
|
|
|
419 |
|
|
=cut |
420 |
|
|
|
421 |
|
|
sub __2022__common ($) { |
422 |
|
|
my $C = shift->SUPER::__2022__common; |
423 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x45"} = 1; ## ISO-IR 165 |
424 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x49"} = 3; ## CNS 11643 plane 3 |
425 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x4A"} = 3; ## CNS 11643 plane 4 |
426 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x4B"} = 3; ## CNS 11643 plane 5 |
427 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x4C"} = 3; ## CNS 11643 plane 6 |
428 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x4D"} = 3; ## CNS 11643 plane 7 |
429 |
|
|
$C; |
430 |
|
|
} |
431 |
|
|
|
432 |
|
|
1; |
433 |
|
|
__END__ |
434 |
|
|
|
435 |
|
|
=back |
436 |
|
|
|
437 |
|
|
=head1 LICENSE |
438 |
|
|
|
439 |
|
|
Copyright 2002 wakaba <w@suika.fam.cx> |
440 |
|
|
|
441 |
|
|
This library is free software; you can redistribute it |
442 |
|
|
and/or modify it under the same terms as Perl itself. |
443 |
|
|
|
444 |
|
|
=cut |
445 |
|
|
|
446 |
|
|
# $Date: $ |
447 |
|
|
### SevenBit.pm ends here |