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 |
wakaba |
1.2 |
__PACKAGE__->Define (qw/iso-2022-7bit 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.2 |
(Alias: junet, jis, jis7) |
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.2 |
__PACKAGE__->Define (qw/iso-2022-7bit-ss2 x-iso-2022-jp-2 jis_encoding csjisencoding/); |
193 |
wakaba |
1.1 |
|
194 |
|
|
=item iso-2022-7bit-ss2 |
195 |
|
|
|
196 |
|
|
ISO/IEC 2022 based 7-bit encoding using SS2 for 96-charset |
197 |
|
|
(Alias: x-iso-2022-jp-2) |
198 |
|
|
|
199 |
|
|
=cut |
200 |
|
|
|
201 |
|
|
sub __2022__common ($) { |
202 |
|
|
my $C = shift->SUPER::__2022__common; |
203 |
|
|
$C->{option}->{designate_to}->{G96}->{default} = 2; |
204 |
|
|
$C->{option}->{designate_to}->{G96n}->{default} = 2; |
205 |
|
|
$C->{option}->{Ginvoke_by_single_shift}->[2] = 1; |
206 |
|
|
$C; |
207 |
|
|
} |
208 |
|
|
|
209 |
|
|
package Encode::ISO2022::SevenBit::JP2; |
210 |
|
|
use vars qw/@ISA/; |
211 |
|
|
push @ISA, 'Encode::ISO2022::SevenBit::SS2'; |
212 |
wakaba |
1.2 |
__PACKAGE__->Define (qw/iso-2022-jp-2 csiso2022jp2/); |
213 |
wakaba |
1.1 |
|
214 |
|
|
=item iso-2022-jp-2 |
215 |
|
|
|
216 |
|
|
ISO/IEC 2022 based 7-bit multilingual encoding, defined by |
217 |
wakaba |
1.2 |
RFC 1554. A subset of iso-2022-7bit-ss2. (Alias: csISO2022JP2 (IANA)) |
218 |
wakaba |
1.1 |
|
219 |
|
|
=cut |
220 |
|
|
|
221 |
|
|
sub __2022__common ($) { |
222 |
|
|
my $C = shift->SUPER::__2022__common; |
223 |
|
|
$C->{option}->{designate_to}->{C0}->{default} = -1; |
224 |
|
|
$C->{option}->{designate_to}->{C0}->{"\x40"} = 0; |
225 |
|
|
$C->{option}->{designate_to}->{C1}->{default} = -1; |
226 |
|
|
$C->{C1} = $Encode::ISO2022::CHARSET{C1}->{"\x47"}; ## Minimum C1 |
227 |
|
|
$C->{option}->{designate_to}->{C1}->{"\x47"} = 1; |
228 |
|
|
$C->{option}->{designate_to}->{G94}->{default} = -1; |
229 |
|
|
$C->{option}->{designate_to}->{G94n}->{default} = -1; |
230 |
|
|
$C->{option}->{designate_to}->{G96}->{default} = -1; |
231 |
|
|
$C->{option}->{designate_to}->{G96n}->{default} = -1; |
232 |
|
|
$C->{option}->{designate_to}->{G94}->{"\x4A"} = 0; ## JIS X 0201 roman |
233 |
|
|
for ("\x40", "\x41", "\x42", "\x43") { |
234 |
|
|
$C->{option}->{designate_to}->{G94n}->{ $_ } = 0; |
235 |
|
|
} |
236 |
|
|
for ("\x41", "\x46") { |
237 |
|
|
$C->{option}->{designate_to}->{G96}->{ $_ } = 2; |
238 |
|
|
} |
239 |
|
|
$C; |
240 |
|
|
} |
241 |
|
|
sub __2022_encode ($) { |
242 |
|
|
my $C = shift->__2022__common; |
243 |
|
|
$C->{C1} = $Encode::ISO2022::CHARSET{C1}->{"\x7E"}; ## empty set |
244 |
|
|
$C->{G1} = $Encode::ISO2022::CHARSET{G96}->{"\x7E"}; ## empty set |
245 |
|
|
$C; |
246 |
|
|
} |
247 |
|
|
|
248 |
|
|
package Encode::ISO2022::SevenBit::Lock; |
249 |
|
|
use vars qw/@ISA/; |
250 |
|
|
push @ISA, 'Encode::ISO2022::SevenBit'; |
251 |
|
|
__PACKAGE__->Define (qw/iso-2022-7bit-lock/); |
252 |
|
|
|
253 |
|
|
=item iso-2022-7bit-lock |
254 |
|
|
|
255 |
|
|
ISO/IEC 2022 based 7-bit encoding using G1 and locking-shift for 96-charset |
256 |
|
|
|
257 |
|
|
=cut |
258 |
|
|
|
259 |
|
|
sub __2022__common ($) { |
260 |
|
|
my $C = shift->SUPER::__2022__common; |
261 |
|
|
$C->{option}->{designate_to}->{G96}->{default} = 1; |
262 |
|
|
$C->{option}->{designate_to}->{G96n}->{default} = 1; |
263 |
|
|
$C; |
264 |
|
|
} |
265 |
|
|
|
266 |
|
|
package Encode::ISO2022::SevenBit::KR; |
267 |
|
|
use vars qw/@ISA/; |
268 |
|
|
push @ISA, 'Encode::ISO2022::SevenBit'; |
269 |
wakaba |
1.2 |
__PACKAGE__->Define (qw/iso-2022-kr korean-iso-7bit csiso2022kr cp50225 kr2022/); |
270 |
wakaba |
1.1 |
|
271 |
|
|
=item iso-2022-kr |
272 |
|
|
|
273 |
|
|
An ISO/IEC 2022 based 7-bit encoding for Korean, |
274 |
wakaba |
1.2 |
defined by RFC 1557 (Alias: korean-iso-7bit (emacsen), |
275 |
|
|
csISO2022KR (IANA), CP50225 (M$), KR2022) |
276 |
wakaba |
1.1 |
|
277 |
|
|
=cut |
278 |
|
|
|
279 |
|
|
sub __2022__common ($) { |
280 |
|
|
my $C = shift->SUPER::__2022__common; |
281 |
|
|
$C->{option}->{designate_to}->{C0}->{default} = -1; |
282 |
|
|
$C->{option}->{designate_to}->{C0}->{"\x40"} = 0; |
283 |
|
|
$C->{option}->{designate_to}->{C1}->{default} = -1; |
284 |
|
|
$C->{option}->{designate_to}->{G94}->{default} = -1; |
285 |
|
|
$C->{option}->{designate_to}->{G94n}->{default} = -1; |
286 |
|
|
$C->{option}->{designate_to}->{G96}->{default} = -1; |
287 |
|
|
$C->{option}->{designate_to}->{G96n}->{default} = -1; |
288 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x43"} = 1; ## KS X 1001 |
289 |
|
|
$C; |
290 |
|
|
} |
291 |
|
|
sub __2022_encode ($) { |
292 |
|
|
my $C = shift->__2022__common; |
293 |
|
|
$C->{C1} = $Encode::ISO2022::CHARSET{C1}->{"\x7E"}; ## empty set |
294 |
|
|
$C->{G1} = $Encode::ISO2022::CHARSET{G96}->{"\x7E"}; ## empty set |
295 |
|
|
$C; |
296 |
|
|
} |
297 |
|
|
sub __2022_decode ($) { |
298 |
|
|
my $C = shift->__2022__common; |
299 |
|
|
$C->{G1} = $Encode::ISO2022::CHARSET{G94n}->{"\x43"}; ## KS X 1001 |
300 |
|
|
$C; |
301 |
|
|
} |
302 |
|
|
|
303 |
|
|
package Encode::ISO2022::SevenBit::INT1; |
304 |
|
|
use vars qw/@ISA/; |
305 |
|
|
push @ISA, 'Encode::ISO2022::SevenBit'; |
306 |
|
|
__PACKAGE__->Define (qw/iso-2022-int-1/); |
307 |
|
|
|
308 |
|
|
=item iso-2022-int-1 |
309 |
|
|
|
310 |
|
|
An ISO/IEC 2022 based 7-bit multilingual encoding, |
311 |
|
|
defined by draft-ohta-text-encoding |
312 |
|
|
|
313 |
|
|
=cut |
314 |
|
|
|
315 |
|
|
sub __2022__common ($) { |
316 |
|
|
my $C = shift->SUPER::__2022__common; |
317 |
|
|
$C->{option}->{designate_to}->{C0}->{default} = -1; |
318 |
|
|
$C->{option}->{designate_to}->{C0}->{"\x40"} = 0; |
319 |
|
|
$C->{option}->{designate_to}->{C1}->{default} = -1; |
320 |
|
|
$C->{option}->{designate_to}->{G94}->{default} = -1; |
321 |
|
|
$C->{option}->{designate_to}->{G94n}->{default} = -1; |
322 |
|
|
$C->{option}->{designate_to}->{G96}->{default} = -1; |
323 |
|
|
$C->{option}->{designate_to}->{G96n}->{default} = -1; |
324 |
|
|
$C->{option}->{designate_to}->{G94}->{"\x4A"} = 0; ## JIS X 0201 roman |
325 |
|
|
for ("\x40", "\x41", "\x42") { |
326 |
|
|
$C->{option}->{designate_to}->{G94n}->{ $_ } = 0; |
327 |
|
|
} |
328 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x43"} = 1; ## KS X 1001 |
329 |
|
|
for ("\x41", "\x46") { ## ISO/IEC 8859-1,7 |
330 |
|
|
$C->{option}->{designate_to}->{G96}->{ $_ } = 1; |
331 |
|
|
} |
332 |
|
|
$C; |
333 |
|
|
} |
334 |
|
|
sub __2022_encode ($) { |
335 |
|
|
my $C = shift->__2022__common; |
336 |
|
|
$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::LockSS2; |
347 |
|
|
use vars qw/@ISA/; |
348 |
|
|
push @ISA, 'Encode::ISO2022::SevenBit'; |
349 |
|
|
__PACKAGE__->Define (qw/iso-2022-7bit-lock-ss2 iso-2022-cjk/); |
350 |
|
|
|
351 |
|
|
=item iso-2022-7bit-lock-ss2 |
352 |
|
|
|
353 |
|
|
An ISO/IEC 2022 based 7-bit encoding. Mixture of ISO-2022-JP, |
354 |
|
|
ISO-2022-KR, ISO-2022-CN. (Alias: iso-2022-cjk (emacsen)) |
355 |
|
|
|
356 |
|
|
=cut |
357 |
|
|
|
358 |
|
|
sub __2022__common ($) { |
359 |
|
|
my $C = shift->SUPER::__2022__common; |
360 |
|
|
$C->{option}->{designate_to}->{G96}->{default} = 2; |
361 |
|
|
$C->{option}->{designate_to}->{G96n}->{default} = 2; |
362 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x41"} = 1; ## GB 2312 |
363 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x43"} = 1; ## KS X 1001 |
364 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x45"} = 1; ## ISO-IR 165 |
365 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x47"} = 1; ## CNS 11643 plane 1 |
366 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x48"} = 2; ## CNS 11643 plane 2 |
367 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x49"} = 3; ## CNS 11643 plane 3 |
368 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x4A"} = 3; ## CNS 11643 plane 4 |
369 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x4B"} = 3; ## CNS 11643 plane 5 |
370 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x4C"} = 3; ## CNS 11643 plane 6 |
371 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x4D"} = 3; ## CNS 11643 plane 7 |
372 |
wakaba |
1.2 |
$C->{option}->{designate_to}->{G94n}->{P0_0} = 1; ## GB 12345 |
373 |
|
|
$C->{option}->{designate_to}->{G94n}->{P0_1} = 2; ## GB 7589 |
374 |
|
|
$C->{option}->{designate_to}->{G94n}->{P0_2} = 2; ## GB 13131 |
375 |
|
|
$C->{option}->{designate_to}->{G94n}->{P0_3} = 3; ## GB 7590 |
376 |
|
|
$C->{option}->{designate_to}->{G94n}->{P0_4} = 3; ## GB 13132 |
377 |
wakaba |
1.1 |
$C; |
378 |
|
|
} |
379 |
|
|
sub __2022_decode ($) { |
380 |
|
|
my $C = shift->__2022__common; |
381 |
|
|
$C->{G1} = $Encode::ISO2022::CHARSET{G94n}->{"\x43"}; ## KS X 1001 |
382 |
|
|
$C; |
383 |
|
|
} |
384 |
|
|
|
385 |
|
|
package Encode::ISO2022::SevenBit::CN; |
386 |
|
|
use vars qw/@ISA/; |
387 |
|
|
push @ISA, 'Encode::ISO2022::SevenBit'; |
388 |
wakaba |
1.2 |
__PACKAGE__->Define (qw/iso-2022-cn chinese-iso-7bit iso2022cn-cns iso2022cn-gb/); |
389 |
wakaba |
1.1 |
|
390 |
|
|
=item iso-2022-cn |
391 |
|
|
|
392 |
|
|
An ISO/IEC 2022 based 7-bit encoding for Chinese, |
393 |
|
|
defined by RFC 1922 (Alias: chinese-iso-7bit (emacsen)) |
394 |
|
|
|
395 |
|
|
=cut |
396 |
|
|
|
397 |
|
|
sub __2022__common ($) { |
398 |
|
|
my $C = shift->SUPER::__2022__common; |
399 |
|
|
$C->{option}->{designate_to}->{C0}->{default} = -1; |
400 |
|
|
$C->{option}->{designate_to}->{C0}->{"\x40"} = 0; |
401 |
|
|
$C->{option}->{designate_to}->{C1}->{default} = -1; |
402 |
|
|
$C->{option}->{designate_to}->{G94}->{default} = -1; |
403 |
|
|
$C->{option}->{designate_to}->{G94n}->{default} = -1; |
404 |
|
|
$C->{option}->{designate_to}->{G96}->{default} = -1; |
405 |
|
|
$C->{option}->{designate_to}->{G96n}->{default} = -1; |
406 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x41"} = 1; ## GB 2312 |
407 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x47"} = 1; ## CNS 11643 plane 1 |
408 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x48"} = 2; ## CNS 11643 plane 2 |
409 |
|
|
$C; |
410 |
|
|
} |
411 |
|
|
sub __2022_encode ($) { |
412 |
|
|
my $C = shift->__2022__common; |
413 |
|
|
$C->{C1} = $Encode::ISO2022::CHARSET{C1}->{"\x7E"}; ## empty set |
414 |
|
|
$C->{G1} = $Encode::ISO2022::CHARSET{G96}->{"\x7E"}; ## empty set |
415 |
|
|
$C; |
416 |
|
|
} |
417 |
|
|
|
418 |
|
|
package Encode::ISO2022::SevenBit::CNExt; |
419 |
|
|
use vars qw/@ISA/; |
420 |
|
|
push @ISA, 'Encode::ISO2022::SevenBit::CN'; |
421 |
|
|
__PACKAGE__->Define (qw/iso-2022-cn-ext/); |
422 |
|
|
|
423 |
|
|
=item iso-2022-cn-ext |
424 |
|
|
|
425 |
|
|
An ISO/IEC 2022 based 7-bit encoding for Chinese, |
426 |
|
|
defined by RFC 1922 |
427 |
|
|
|
428 |
|
|
=cut |
429 |
|
|
|
430 |
|
|
sub __2022__common ($) { |
431 |
|
|
my $C = shift->SUPER::__2022__common; |
432 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x45"} = 1; ## ISO-IR 165 |
433 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x49"} = 3; ## CNS 11643 plane 3 |
434 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x4A"} = 3; ## CNS 11643 plane 4 |
435 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x4B"} = 3; ## CNS 11643 plane 5 |
436 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x4C"} = 3; ## CNS 11643 plane 6 |
437 |
|
|
$C->{option}->{designate_to}->{G94n}->{"\x4D"} = 3; ## CNS 11643 plane 7 |
438 |
wakaba |
1.2 |
$C->{option}->{designate_to}->{G94n}->{P0_0} = 1; ## GB 12345 |
439 |
|
|
$C->{option}->{designate_to}->{G94n}->{P0_1} = 2; ## GB 7589 |
440 |
|
|
$C->{option}->{designate_to}->{G94n}->{P0_2} = 2; ## GB 13131 |
441 |
|
|
$C->{option}->{designate_to}->{G94n}->{P0_3} = 3; ## GB 7590 |
442 |
|
|
$C->{option}->{designate_to}->{G94n}->{P0_4} = 3; ## GB 13132 |
443 |
|
|
$C->{option}->{designate_to}->{G94n}->{P1_0} = 3; ## CNS 11643 plane 8 |
444 |
|
|
$C->{option}->{designate_to}->{G94n}->{P1_1} = 3; ## CNS 11643 plane 9 |
445 |
|
|
$C->{option}->{designate_to}->{G94n}->{P1_2} = 3; ## CNS 11643 plane 10 |
446 |
|
|
$C->{option}->{designate_to}->{G94n}->{P1_3} = 3; ## CNS 11643 plane 11 |
447 |
|
|
$C->{option}->{designate_to}->{G94n}->{P1_4} = 3; ## CNS 11643 plane 12 |
448 |
|
|
$C->{option}->{designate_to}->{G94n}->{P1_5} = 3; ## CNS 11643 plane 13 |
449 |
|
|
$C->{option}->{designate_to}->{G94n}->{P1_6} = 3; ## CNS 11643 plane 14 |
450 |
|
|
$C->{option}->{designate_to}->{G94n}->{P2_0} = 3; ## CNS 11643 plane 15 |
451 |
|
|
$C->{option}->{designate_to}->{G94n}->{P2_1} = 3; ## CNS 11643 plane 16 |
452 |
wakaba |
1.1 |
$C; |
453 |
|
|
} |
454 |
|
|
|
455 |
|
|
1; |
456 |
|
|
__END__ |
457 |
|
|
|
458 |
|
|
=back |
459 |
|
|
|
460 |
|
|
=head1 LICENSE |
461 |
|
|
|
462 |
|
|
Copyright 2002 wakaba <w@suika.fam.cx> |
463 |
|
|
|
464 |
|
|
This library is free software; you can redistribute it |
465 |
|
|
and/or modify it under the same terms as Perl itself. |
466 |
|
|
|
467 |
|
|
=cut |
468 |
|
|
|
469 |
|
|
# $Date: $ |
470 |
|
|
### SevenBit.pm ends here |