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