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 |
wakaba |
1.3 |
$VERSION=do{my @r=(q$Revision: 1.2 $=~/\d+/g);sprintf "%d."."%02d" x $#r,@r}; |
17 |
wakaba |
1.1 |
use base qw(Encode::Encoding); |
18 |
wakaba |
1.3 |
__PACKAGE__->Define (qw/iso-2022-7bit iso-2022-7 jis junet jis7/); |
19 |
wakaba |
1.1 |
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 |
wakaba |
1.3 |
(Alias: junet, jis, jis7, iso-2022-7) |
38 |
wakaba |
1.1 |
|
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 |
wakaba |
1.2 |
__PACKAGE__->Define (qw/iso-2022-jp junet-code japanese-iso-7bit csiso2022jp |
63 |
|
|
cp50220 iso2022jp/); |
64 |
wakaba |
1.1 |
|
65 |
|
|
=item iso-2022-jp |
66 |
|
|
|
67 |
|
|
ISO/IEC 2022 based 7-bit encoding for Japanese. |
68 |
|
|
Defined by Junet no tebiki, RFC 1468 and JIS X 0208:1997 Appendix 2. |
69 |
wakaba |
1.2 |
(Alias: junet-code, japanese-iso-7bit (emacsen), csISO2022JP (IANA), |
70 |
|
|
CP50220 (M$)) |
71 |
wakaba |
1.1 |
|
72 |
|
|
=cut |
73 |
|
|
|
74 |
|
|
sub __2022__common ($) { |
75 |
|
|
my $C = Encode::ISO2022->new_object; |
76 |
|
|
$C->{bit} = 7; |
77 |
|
|
$C->{option}->{designate_to}->{C0}->{default} = -1; |
78 |
|
|
$C->{option}->{designate_to}->{C0}->{"\x40"} = 0; |
79 |
|
|
$C->{option}->{designate_to}->{C1}->{default} = -1; |
80 |
|
|
$C->{option}->{designate_to}->{G94}->{default} = -1; |
81 |
|
|
$C->{option}->{designate_to}->{G94n}->{default} = -1; |
82 |
|
|
$C->{option}->{designate_to}->{G96}->{default} = -1; |
83 |
|
|
$C->{option}->{designate_to}->{G96n}->{default} = -1; |
84 |
|
|
$C->{option}->{designate_to}->{G94}->{"\x4A"} = 0; ## JIS X 0201 roman |
85 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x40"} = 0; ## JIS X 0208-1978 |
86 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x42"} = 0; ## JIS X 0208-1983 |
87 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x42\x40"} = 0; ## JIS X 0208-1990 |
88 |
|
|
$C->{option}->{use_revision} = 0; |
89 |
|
|
$C; |
90 |
|
|
} |
91 |
|
|
sub __2022_encode ($) { |
92 |
|
|
my $C = shift->__2022__common; |
93 |
|
|
$C->{C1} = $Encode::ISO2022::CHARSET{C1}->{"\x7E"}; ## empty set |
94 |
|
|
$C->{G1} = $Encode::ISO2022::CHARSET{G96}->{"\x7E"}; ## empty set |
95 |
|
|
$C; |
96 |
|
|
} |
97 |
|
|
|
98 |
|
|
package Encode::ISO2022::SevenBit::JP1978IRV; |
99 |
|
|
use vars qw/@ISA/; |
100 |
|
|
push @ISA, 'Encode::ISO2022::SevenBit::JP'; |
101 |
wakaba |
1.2 |
__PACKAGE__->Define (qw/iso-2022-jp-1978-irv japanese-iso-7bit-1978-irv old-jis |
102 |
|
|
x-obsoleted-iso-2022-jp/); |
103 |
wakaba |
1.1 |
|
104 |
|
|
=item iso-2022-jp-1978-irv |
105 |
|
|
|
106 |
|
|
ISO/IEC 2022 based 7-bit encoding for Japanese. |
107 |
|
|
(Alias: japanese-iso-7bit-1978-irv (emacsen), old-jis (emacsen)) |
108 |
|
|
|
109 |
|
|
=cut |
110 |
|
|
|
111 |
|
|
sub __2022_encode ($) { |
112 |
|
|
my $C = shift->__2022__common; |
113 |
|
|
$C->{option}->{designate_to}->{G94}->{"\x4A"} = -1; ## JIS X 0201 roman |
114 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x42"} = -1; ## JIS X 0208-1983 |
115 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x42\x40"} = -1; ## JIS X 0208-1990 |
116 |
|
|
$C; |
117 |
|
|
} |
118 |
|
|
|
119 |
|
|
package Encode::ISO2022::SevenBit::JP1; |
120 |
|
|
use vars qw/@ISA/; |
121 |
|
|
push @ISA, 'Encode::ISO2022::SevenBit::JP'; |
122 |
|
|
__PACKAGE__->Define (qw/iso-2022-jp-1/); |
123 |
|
|
|
124 |
|
|
=item iso-2022-jp-1 |
125 |
|
|
|
126 |
|
|
ISO/IEC 2022 based 7-bit encoding for Japanese, |
127 |
|
|
defined by RFC 2237 |
128 |
|
|
|
129 |
|
|
=cut |
130 |
|
|
|
131 |
|
|
sub __2022__common ($) { |
132 |
|
|
my $C = shift->SUPER::__2022__common; |
133 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x44"} = 0; ## JIS X 0212-1990 |
134 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x42\x40"} = -1; ## JIS X 0208-1990 |
135 |
|
|
$C; |
136 |
|
|
} |
137 |
|
|
|
138 |
|
|
package Encode::ISO2022::SevenBit::JP3; |
139 |
|
|
use vars qw/@ISA/; |
140 |
|
|
push @ISA, 'Encode::ISO2022::SevenBit::JP'; |
141 |
|
|
__PACKAGE__->Define (qw/iso-2022-jp-3 x-iso-2022-jp-3 iso-2022-jp-3-compatible iso-2022-jp-3-strict/); |
142 |
|
|
|
143 |
|
|
=item iso-2022-jp-3 |
144 |
|
|
|
145 |
|
|
ISO/IEC 2022 based 7-bit encoding for Japanese, |
146 |
|
|
defined by JIS X 0213:2000 Appendix 2. |
147 |
|
|
(Alias: x-iso-2022-jp-3) |
148 |
|
|
|
149 |
|
|
=item iso-2022-jp-3-compatible |
150 |
|
|
|
151 |
|
|
ISO/IEC 2022 based 7-bit encoding for Japanese |
152 |
|
|
|
153 |
|
|
=item iso-2022-jp-3-strict |
154 |
|
|
|
155 |
|
|
ISO/IEC 2022 based 7-bit encoding for Japanese. |
156 |
|
|
A subset of iso-2022-jp-3. |
157 |
|
|
|
158 |
|
|
=cut |
159 |
|
|
|
160 |
|
|
sub __2022__common ($) { |
161 |
|
|
my $C = shift->SUPER::__2022__common; |
162 |
|
|
$C->{option}->{designate_to}->{G94}->{"\x4A"} = -1; ## JIS X 0201 roman |
163 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x40"} = -1; ## JIS X 0208-1978 |
164 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x42"} = 0; ## restricted JIS X 0213:2000 plane 1 |
165 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x42\x40"} = -1; ## JIS X 0208-1990 |
166 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x4F"} = 0; ## JIS X 0213:2000 plane 1 |
167 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x50"} = 0; ## JIS X 0213:2000 plane 2 |
168 |
|
|
$C; |
169 |
|
|
} |
170 |
|
|
|
171 |
|
|
package Encode::ISO2022::SevenBit::JP3Plane1; |
172 |
|
|
use vars qw/@ISA/; |
173 |
|
|
push @ISA, 'Encode::ISO2022::SevenBit::JP3'; |
174 |
|
|
__PACKAGE__->Define (qw/iso-2022-jp-3-plane1/); |
175 |
|
|
|
176 |
|
|
=item iso-2022-jp-3-plane1 |
177 |
|
|
|
178 |
|
|
ISO/IEC 2022 based 7-bit encoding for Japanese, |
179 |
|
|
defined by JIS X 0213:2000 Appendix 2. |
180 |
|
|
|
181 |
|
|
=cut |
182 |
|
|
|
183 |
|
|
sub __2022__common ($) { |
184 |
|
|
my $C = shift->SUPER::__2022__common; |
185 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x50"} = -1; ## JIS X 0213:2000 plane 2 |
186 |
|
|
$C; |
187 |
|
|
} |
188 |
|
|
|
189 |
|
|
package Encode::ISO2022::SevenBit::SS2; |
190 |
|
|
use vars qw/@ISA/; |
191 |
|
|
push @ISA, 'Encode::ISO2022::SevenBit'; |
192 |
wakaba |
1.3 |
__PACKAGE__->Define (qw/iso-2022-7bit-ss2 x-iso-2022-jp-2 iso-2022-ss2-7 |
193 |
|
|
jis_encoding csjisencoding/); |
194 |
wakaba |
1.1 |
|
195 |
|
|
=item iso-2022-7bit-ss2 |
196 |
|
|
|
197 |
|
|
ISO/IEC 2022 based 7-bit encoding using SS2 for 96-charset |
198 |
wakaba |
1.3 |
(Alias: x-iso-2022-jp-2, iso-2022-ss2-7 (emacsen)) |
199 |
wakaba |
1.1 |
|
200 |
|
|
=cut |
201 |
|
|
|
202 |
|
|
sub __2022__common ($) { |
203 |
|
|
my $C = shift->SUPER::__2022__common; |
204 |
|
|
$C->{option}->{designate_to}->{G96}->{default} = 2; |
205 |
|
|
$C->{option}->{designate_to}->{G96n}->{default} = 2; |
206 |
|
|
$C->{option}->{Ginvoke_by_single_shift}->[2] = 1; |
207 |
|
|
$C; |
208 |
|
|
} |
209 |
|
|
|
210 |
|
|
package Encode::ISO2022::SevenBit::JP2; |
211 |
|
|
use vars qw/@ISA/; |
212 |
|
|
push @ISA, 'Encode::ISO2022::SevenBit::SS2'; |
213 |
wakaba |
1.2 |
__PACKAGE__->Define (qw/iso-2022-jp-2 csiso2022jp2/); |
214 |
wakaba |
1.1 |
|
215 |
|
|
=item iso-2022-jp-2 |
216 |
|
|
|
217 |
|
|
ISO/IEC 2022 based 7-bit multilingual encoding, defined by |
218 |
wakaba |
1.2 |
RFC 1554. A subset of iso-2022-7bit-ss2. (Alias: csISO2022JP2 (IANA)) |
219 |
wakaba |
1.1 |
|
220 |
|
|
=cut |
221 |
|
|
|
222 |
|
|
sub __2022__common ($) { |
223 |
|
|
my $C = shift->SUPER::__2022__common; |
224 |
|
|
$C->{option}->{designate_to}->{C0}->{default} = -1; |
225 |
|
|
$C->{option}->{designate_to}->{C0}->{"\x40"} = 0; |
226 |
|
|
$C->{option}->{designate_to}->{C1}->{default} = -1; |
227 |
|
|
$C->{C1} = $Encode::ISO2022::CHARSET{C1}->{"\x47"}; ## Minimum C1 |
228 |
|
|
$C->{option}->{designate_to}->{C1}->{"\x47"} = 1; |
229 |
|
|
$C->{option}->{designate_to}->{G94}->{default} = -1; |
230 |
|
|
$C->{option}->{designate_to}->{G94n}->{default} = -1; |
231 |
|
|
$C->{option}->{designate_to}->{G96}->{default} = -1; |
232 |
|
|
$C->{option}->{designate_to}->{G96n}->{default} = -1; |
233 |
|
|
$C->{option}->{designate_to}->{G94}->{"\x4A"} = 0; ## JIS X 0201 roman |
234 |
|
|
for ("\x40", "\x41", "\x42", "\x43") { |
235 |
|
|
$C->{option}->{designate_to}->{G94n}->{ $_ } = 0; |
236 |
|
|
} |
237 |
|
|
for ("\x41", "\x46") { |
238 |
|
|
$C->{option}->{designate_to}->{G96}->{ $_ } = 2; |
239 |
|
|
} |
240 |
|
|
$C; |
241 |
|
|
} |
242 |
|
|
sub __2022_encode ($) { |
243 |
|
|
my $C = shift->__2022__common; |
244 |
|
|
$C->{C1} = $Encode::ISO2022::CHARSET{C1}->{"\x7E"}; ## empty set |
245 |
|
|
$C->{G1} = $Encode::ISO2022::CHARSET{G96}->{"\x7E"}; ## empty set |
246 |
|
|
$C; |
247 |
|
|
} |
248 |
|
|
|
249 |
|
|
package Encode::ISO2022::SevenBit::Lock; |
250 |
|
|
use vars qw/@ISA/; |
251 |
|
|
push @ISA, 'Encode::ISO2022::SevenBit'; |
252 |
|
|
__PACKAGE__->Define (qw/iso-2022-7bit-lock/); |
253 |
|
|
|
254 |
|
|
=item iso-2022-7bit-lock |
255 |
|
|
|
256 |
|
|
ISO/IEC 2022 based 7-bit encoding using G1 and locking-shift for 96-charset |
257 |
|
|
|
258 |
|
|
=cut |
259 |
|
|
|
260 |
|
|
sub __2022__common ($) { |
261 |
|
|
my $C = shift->SUPER::__2022__common; |
262 |
|
|
$C->{option}->{designate_to}->{G96}->{default} = 1; |
263 |
|
|
$C->{option}->{designate_to}->{G96n}->{default} = 1; |
264 |
|
|
$C; |
265 |
|
|
} |
266 |
|
|
|
267 |
wakaba |
1.3 |
package Encode::ISO2022::SevenBit::INT; |
268 |
|
|
use vars qw/@ISA/; |
269 |
|
|
push @ISA, 'Encode::ISO2022::SevenBit'; |
270 |
|
|
__PACKAGE__->Define (qw/iso-2022-int iso-2022-int-* iso-2022-int-2/); |
271 |
|
|
|
272 |
|
|
=item iso-2022-int |
273 |
|
|
|
274 |
|
|
ISO/IEC 2022 based 7-bit encoding using G1 and locking-shift for |
275 |
|
|
KS X 1001 and 96-charset. See draft-ohta-text-encoding. |
276 |
|
|
(Alias: iso-2022-int-*) |
277 |
|
|
|
278 |
|
|
=cut |
279 |
|
|
|
280 |
|
|
sub __2022__common ($) { |
281 |
|
|
my $C = shift->SUPER::__2022__common; |
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 |
wakaba |
1.1 |
package Encode::ISO2022::SevenBit::KR; |
300 |
|
|
use vars qw/@ISA/; |
301 |
|
|
push @ISA, 'Encode::ISO2022::SevenBit'; |
302 |
wakaba |
1.2 |
__PACKAGE__->Define (qw/iso-2022-kr korean-iso-7bit csiso2022kr cp50225 kr2022/); |
303 |
wakaba |
1.1 |
|
304 |
|
|
=item iso-2022-kr |
305 |
|
|
|
306 |
|
|
An ISO/IEC 2022 based 7-bit encoding for Korean, |
307 |
wakaba |
1.2 |
defined by RFC 1557 (Alias: korean-iso-7bit (emacsen), |
308 |
|
|
csISO2022KR (IANA), CP50225 (M$), KR2022) |
309 |
wakaba |
1.1 |
|
310 |
|
|
=cut |
311 |
|
|
|
312 |
|
|
sub __2022__common ($) { |
313 |
|
|
my $C = shift->SUPER::__2022__common; |
314 |
|
|
$C->{option}->{designate_to}->{C0}->{default} = -1; |
315 |
|
|
$C->{option}->{designate_to}->{C0}->{"\x40"} = 0; |
316 |
|
|
$C->{option}->{designate_to}->{C1}->{default} = -1; |
317 |
|
|
$C->{option}->{designate_to}->{G94}->{default} = -1; |
318 |
|
|
$C->{option}->{designate_to}->{G94n}->{default} = -1; |
319 |
|
|
$C->{option}->{designate_to}->{G96}->{default} = -1; |
320 |
|
|
$C->{option}->{designate_to}->{G96n}->{default} = -1; |
321 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x43"} = 1; ## KS X 1001 |
322 |
|
|
$C; |
323 |
|
|
} |
324 |
|
|
sub __2022_encode ($) { |
325 |
|
|
my $C = shift->__2022__common; |
326 |
|
|
$C->{C1} = $Encode::ISO2022::CHARSET{C1}->{"\x7E"}; ## empty set |
327 |
|
|
$C->{G1} = $Encode::ISO2022::CHARSET{G96}->{"\x7E"}; ## empty set |
328 |
|
|
$C; |
329 |
|
|
} |
330 |
|
|
sub __2022_decode ($) { |
331 |
|
|
my $C = shift->__2022__common; |
332 |
|
|
$C->{G1} = $Encode::ISO2022::CHARSET{G94n}->{"\x43"}; ## KS X 1001 |
333 |
|
|
$C; |
334 |
|
|
} |
335 |
|
|
|
336 |
|
|
package Encode::ISO2022::SevenBit::INT1; |
337 |
|
|
use vars qw/@ISA/; |
338 |
|
|
push @ISA, 'Encode::ISO2022::SevenBit'; |
339 |
|
|
__PACKAGE__->Define (qw/iso-2022-int-1/); |
340 |
|
|
|
341 |
|
|
=item iso-2022-int-1 |
342 |
|
|
|
343 |
|
|
An ISO/IEC 2022 based 7-bit multilingual encoding, |
344 |
|
|
defined by draft-ohta-text-encoding |
345 |
|
|
|
346 |
|
|
=cut |
347 |
|
|
|
348 |
|
|
sub __2022__common ($) { |
349 |
|
|
my $C = shift->SUPER::__2022__common; |
350 |
|
|
$C->{option}->{designate_to}->{C0}->{default} = -1; |
351 |
|
|
$C->{option}->{designate_to}->{C0}->{"\x40"} = 0; |
352 |
|
|
$C->{option}->{designate_to}->{C1}->{default} = -1; |
353 |
|
|
$C->{option}->{designate_to}->{G94}->{default} = -1; |
354 |
|
|
$C->{option}->{designate_to}->{G94n}->{default} = -1; |
355 |
|
|
$C->{option}->{designate_to}->{G96}->{default} = -1; |
356 |
|
|
$C->{option}->{designate_to}->{G96n}->{default} = -1; |
357 |
|
|
$C->{option}->{designate_to}->{G94}->{"\x4A"} = 0; ## JIS X 0201 roman |
358 |
|
|
for ("\x40", "\x41", "\x42") { |
359 |
|
|
$C->{option}->{designate_to}->{G94n}->{ $_ } = 0; |
360 |
|
|
} |
361 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x43"} = 1; ## KS X 1001 |
362 |
|
|
for ("\x41", "\x46") { ## ISO/IEC 8859-1,7 |
363 |
|
|
$C->{option}->{designate_to}->{G96}->{ $_ } = 1; |
364 |
|
|
} |
365 |
|
|
$C; |
366 |
|
|
} |
367 |
|
|
sub __2022_encode ($) { |
368 |
|
|
my $C = shift->__2022__common; |
369 |
|
|
$C->{C1} = $Encode::ISO2022::CHARSET{C1}->{"\x7E"}; ## empty set |
370 |
|
|
$C->{G1} = $Encode::ISO2022::CHARSET{G96}->{"\x7E"}; ## empty set |
371 |
|
|
$C; |
372 |
|
|
} |
373 |
|
|
sub __2022_decode ($) { |
374 |
|
|
my $C = shift->__2022__common; |
375 |
|
|
$C->{G1} = $Encode::ISO2022::CHARSET{G94n}->{"\x43"}; ## KS X 1001 |
376 |
|
|
$C; |
377 |
|
|
} |
378 |
|
|
|
379 |
|
|
package Encode::ISO2022::SevenBit::LockSS2; |
380 |
|
|
use vars qw/@ISA/; |
381 |
|
|
push @ISA, 'Encode::ISO2022::SevenBit'; |
382 |
|
|
__PACKAGE__->Define (qw/iso-2022-7bit-lock-ss2 iso-2022-cjk/); |
383 |
|
|
|
384 |
|
|
=item iso-2022-7bit-lock-ss2 |
385 |
|
|
|
386 |
|
|
An ISO/IEC 2022 based 7-bit encoding. Mixture of ISO-2022-JP, |
387 |
|
|
ISO-2022-KR, ISO-2022-CN. (Alias: iso-2022-cjk (emacsen)) |
388 |
|
|
|
389 |
|
|
=cut |
390 |
|
|
|
391 |
|
|
sub __2022__common ($) { |
392 |
|
|
my $C = shift->SUPER::__2022__common; |
393 |
|
|
$C->{option}->{designate_to}->{G96}->{default} = 2; |
394 |
|
|
$C->{option}->{designate_to}->{G96n}->{default} = 2; |
395 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x41"} = 1; ## GB 2312 |
396 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x43"} = 1; ## KS X 1001 |
397 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x45"} = 1; ## ISO-IR 165 |
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->{option}->{designate_to}->{G94n}->{"\x49"} = 3; ## CNS 11643 plane 3 |
401 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x4A"} = 3; ## CNS 11643 plane 4 |
402 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x4B"} = 3; ## CNS 11643 plane 5 |
403 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x4C"} = 3; ## CNS 11643 plane 6 |
404 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x4D"} = 3; ## CNS 11643 plane 7 |
405 |
wakaba |
1.2 |
$C->{option}->{designate_to}->{G94n}->{P0_0} = 1; ## GB 12345 |
406 |
|
|
$C->{option}->{designate_to}->{G94n}->{P0_1} = 2; ## GB 7589 |
407 |
|
|
$C->{option}->{designate_to}->{G94n}->{P0_2} = 2; ## GB 13131 |
408 |
|
|
$C->{option}->{designate_to}->{G94n}->{P0_3} = 3; ## GB 7590 |
409 |
|
|
$C->{option}->{designate_to}->{G94n}->{P0_4} = 3; ## GB 13132 |
410 |
wakaba |
1.1 |
$C; |
411 |
|
|
} |
412 |
|
|
sub __2022_decode ($) { |
413 |
|
|
my $C = shift->__2022__common; |
414 |
|
|
$C->{G1} = $Encode::ISO2022::CHARSET{G94n}->{"\x43"}; ## KS X 1001 |
415 |
|
|
$C; |
416 |
|
|
} |
417 |
|
|
|
418 |
|
|
package Encode::ISO2022::SevenBit::CN; |
419 |
|
|
use vars qw/@ISA/; |
420 |
|
|
push @ISA, 'Encode::ISO2022::SevenBit'; |
421 |
wakaba |
1.2 |
__PACKAGE__->Define (qw/iso-2022-cn chinese-iso-7bit iso2022cn-cns iso2022cn-gb/); |
422 |
wakaba |
1.1 |
|
423 |
|
|
=item iso-2022-cn |
424 |
|
|
|
425 |
|
|
An ISO/IEC 2022 based 7-bit encoding for Chinese, |
426 |
|
|
defined by RFC 1922 (Alias: chinese-iso-7bit (emacsen)) |
427 |
|
|
|
428 |
|
|
=cut |
429 |
|
|
|
430 |
|
|
sub __2022__common ($) { |
431 |
|
|
my $C = shift->SUPER::__2022__common; |
432 |
|
|
$C->{option}->{designate_to}->{C0}->{default} = -1; |
433 |
|
|
$C->{option}->{designate_to}->{C0}->{"\x40"} = 0; |
434 |
|
|
$C->{option}->{designate_to}->{C1}->{default} = -1; |
435 |
|
|
$C->{option}->{designate_to}->{G94}->{default} = -1; |
436 |
|
|
$C->{option}->{designate_to}->{G94n}->{default} = -1; |
437 |
|
|
$C->{option}->{designate_to}->{G96}->{default} = -1; |
438 |
|
|
$C->{option}->{designate_to}->{G96n}->{default} = -1; |
439 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x41"} = 1; ## GB 2312 |
440 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x47"} = 1; ## CNS 11643 plane 1 |
441 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x48"} = 2; ## CNS 11643 plane 2 |
442 |
|
|
$C; |
443 |
|
|
} |
444 |
|
|
sub __2022_encode ($) { |
445 |
|
|
my $C = shift->__2022__common; |
446 |
|
|
$C->{C1} = $Encode::ISO2022::CHARSET{C1}->{"\x7E"}; ## empty set |
447 |
|
|
$C->{G1} = $Encode::ISO2022::CHARSET{G96}->{"\x7E"}; ## empty set |
448 |
|
|
$C; |
449 |
|
|
} |
450 |
|
|
|
451 |
|
|
package Encode::ISO2022::SevenBit::CNExt; |
452 |
|
|
use vars qw/@ISA/; |
453 |
|
|
push @ISA, 'Encode::ISO2022::SevenBit::CN'; |
454 |
|
|
__PACKAGE__->Define (qw/iso-2022-cn-ext/); |
455 |
|
|
|
456 |
|
|
=item iso-2022-cn-ext |
457 |
|
|
|
458 |
|
|
An ISO/IEC 2022 based 7-bit encoding for Chinese, |
459 |
|
|
defined by RFC 1922 |
460 |
|
|
|
461 |
|
|
=cut |
462 |
|
|
|
463 |
|
|
sub __2022__common ($) { |
464 |
|
|
my $C = shift->SUPER::__2022__common; |
465 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x45"} = 1; ## ISO-IR 165 |
466 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x49"} = 3; ## CNS 11643 plane 3 |
467 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x4A"} = 3; ## CNS 11643 plane 4 |
468 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x4B"} = 3; ## CNS 11643 plane 5 |
469 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x4C"} = 3; ## CNS 11643 plane 6 |
470 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x4D"} = 3; ## CNS 11643 plane 7 |
471 |
wakaba |
1.2 |
$C->{option}->{designate_to}->{G94n}->{P0_0} = 1; ## GB 12345 |
472 |
|
|
$C->{option}->{designate_to}->{G94n}->{P0_1} = 2; ## GB 7589 |
473 |
|
|
$C->{option}->{designate_to}->{G94n}->{P0_2} = 2; ## GB 13131 |
474 |
|
|
$C->{option}->{designate_to}->{G94n}->{P0_3} = 3; ## GB 7590 |
475 |
|
|
$C->{option}->{designate_to}->{G94n}->{P0_4} = 3; ## GB 13132 |
476 |
|
|
$C->{option}->{designate_to}->{G94n}->{P1_0} = 3; ## CNS 11643 plane 8 |
477 |
|
|
$C->{option}->{designate_to}->{G94n}->{P1_1} = 3; ## CNS 11643 plane 9 |
478 |
|
|
$C->{option}->{designate_to}->{G94n}->{P1_2} = 3; ## CNS 11643 plane 10 |
479 |
|
|
$C->{option}->{designate_to}->{G94n}->{P1_3} = 3; ## CNS 11643 plane 11 |
480 |
|
|
$C->{option}->{designate_to}->{G94n}->{P1_4} = 3; ## CNS 11643 plane 12 |
481 |
|
|
$C->{option}->{designate_to}->{G94n}->{P1_5} = 3; ## CNS 11643 plane 13 |
482 |
|
|
$C->{option}->{designate_to}->{G94n}->{P1_6} = 3; ## CNS 11643 plane 14 |
483 |
|
|
$C->{option}->{designate_to}->{G94n}->{P2_0} = 3; ## CNS 11643 plane 15 |
484 |
|
|
$C->{option}->{designate_to}->{G94n}->{P2_1} = 3; ## CNS 11643 plane 16 |
485 |
wakaba |
1.1 |
$C; |
486 |
|
|
} |
487 |
|
|
|
488 |
|
|
1; |
489 |
|
|
__END__ |
490 |
|
|
|
491 |
|
|
=back |
492 |
|
|
|
493 |
|
|
=head1 LICENSE |
494 |
|
|
|
495 |
|
|
Copyright 2002 wakaba <w@suika.fam.cx> |
496 |
|
|
|
497 |
|
|
This library is free software; you can redistribute it |
498 |
|
|
and/or modify it under the same terms as Perl itself. |
499 |
|
|
|
500 |
|
|
=cut |
501 |
|
|
|
502 |
wakaba |
1.3 |
# $Date: 2002/09/15 05:08:13 $ |
503 |
wakaba |
1.1 |
### SevenBit.pm ends here |