1 |
wakaba |
1.1 |
=head1 NAME |
2 |
|
|
|
3 |
|
|
C<Encode::ISO2022::JIS> --- Encode and decode of ISO/IEC 2022 |
4 |
|
|
based encodings defined by JIS (Japan Industrial Standard), |
5 |
|
|
other than RFC 1468 coded representation, C<ISO-2022-JP-3> |
6 |
|
|
coded representations and C<EUC-JISX0213> coded representations |
7 |
|
|
|
8 |
|
|
=head1 ENCODINGS |
9 |
|
|
|
10 |
|
|
=over 4 |
11 |
|
|
|
12 |
|
|
=cut |
13 |
|
|
|
14 |
|
|
require 5.7.3; |
15 |
|
|
use strict; |
16 |
|
|
package Encode::ISO2022::JIS; |
17 |
|
|
use vars qw($VERSION); |
18 |
wakaba |
1.6 |
$VERSION=do{my @r=(q$Revision: 1.5 $=~/\d+/g);sprintf "%d."."%02d" x $#r,@r}; |
19 |
wakaba |
1.1 |
use base qw(Encode::Encoding); |
20 |
|
|
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 |
|
|
sub __2022__common ($) { |
36 |
|
|
my $C = Encode::ISO2022->new_object; |
37 |
|
|
$C->{option}->{designate_to}->{C0}->{default} = -1; |
38 |
|
|
$C->{option}->{designate_to}->{C1}->{default} = -1; |
39 |
|
|
$C->{option}->{designate_to}->{G94}->{default} = -1; |
40 |
|
|
$C->{option}->{designate_to}->{G94}->{B} = -1; |
41 |
|
|
$C->{option}->{designate_to}->{G94n}->{default} = -1; |
42 |
|
|
$C->{option}->{designate_to}->{G96}->{default} = -1; |
43 |
|
|
$C->{option}->{designate_to}->{G96n}->{default} = -1; |
44 |
|
|
$C->{G1} = $Encode::ISO2022::CHARSET{G94}->{"\x7E"}; ## empty |
45 |
|
|
$C->{option}->{reset}->{Gdesignation} = 0; |
46 |
|
|
$C->{option}->{reset}->{Ginvoke} = 0; |
47 |
|
|
$C->{option}->{undef_char} = ["\x22\x2E", ## GETA MARK |
48 |
|
|
{type => 'G94n', charset => 'B', revision => '@'}]; |
49 |
|
|
$C; |
50 |
|
|
} |
51 |
|
|
sub __2022_encode ($) { |
52 |
|
|
my $C = shift->__2022__common; |
53 |
|
|
$C; |
54 |
|
|
} |
55 |
|
|
sub __2022_decode ($) { |
56 |
|
|
my $C = shift->__2022__common; |
57 |
|
|
$C; |
58 |
|
|
} |
59 |
|
|
|
60 |
wakaba |
1.5 |
sub __clone ($) { |
61 |
|
|
my $self = shift; |
62 |
|
|
bless {%$self}, ref $self; |
63 |
|
|
}; |
64 |
|
|
|
65 |
wakaba |
1.2 |
package Encode::ISO2022::JIS::JISX0201Latin7; |
66 |
wakaba |
1.1 |
use vars qw/@ISA/; |
67 |
|
|
push @ISA, 'Encode::ISO2022::JIS'; |
68 |
|
|
__PACKAGE__->Define (qw/jisx0201-1997-latin-7bit JIS_C6220-1969-ro |
69 |
wakaba |
1.4 |
iso-ir-14 ir14 jp ISO646-JP 646-jp csISO14JISC6220ro/); |
70 |
wakaba |
1.1 |
|
71 |
|
|
=item jisx0201-1997-latin-7bit |
72 |
|
|
|
73 |
|
|
JIS X 0201:1997 6.1 7-bit code for Latin. |
74 |
|
|
(Alias: C<JIS_C6220-1969-ro> (RFC 1345), C<iso-ir-14> (RFC 1345), |
75 |
wakaba |
1.4 |
C<ir14>, C<jp> (RFC 1345), C<ISO646-JP> (RFC 1345), C<646-jp>, |
76 |
|
|
C<csISO14JISC6220ro> (IANA)) |
77 |
wakaba |
1.1 |
|
78 |
|
|
=cut |
79 |
|
|
|
80 |
|
|
sub __2022__common ($) { |
81 |
|
|
my $C = shift->SUPER::__2022__common; |
82 |
|
|
$C->{bit} = 7; |
83 |
|
|
$C->{G0} = $Encode::ISO2022::CHARSET{G94}->{J}; ## JIS X 0201:1997 Latin set |
84 |
wakaba |
1.4 |
$C->{G1} = $C->{G0}; $C->{G2} = $C->{G1}; ## RFC 1345 (not in JIS) |
85 |
|
|
$C->{G3} = $C->{G1}; |
86 |
wakaba |
1.1 |
$C->{option}->{undef_char} = ["\x3F", {type => 'G94', charset => 'J'}]; |
87 |
|
|
$C; |
88 |
|
|
} |
89 |
|
|
|
90 |
wakaba |
1.2 |
package Encode::ISO2022::JIS::JISX0201Katakana7; |
91 |
wakaba |
1.1 |
use vars qw/@ISA/; |
92 |
|
|
push @ISA, 'Encode::ISO2022::JIS'; |
93 |
|
|
__PACKAGE__->Define (qw/jisx0201-1997-katakana-7bit JIS_C6220-1969-jp JIS_C6220-1969 |
94 |
wakaba |
1.4 |
iso-ir-13 ir13 katakana x0201-7 csISO13JISC6220jp/); |
95 |
wakaba |
1.1 |
|
96 |
|
|
=item jisx0201-1997-katakana-7bit |
97 |
|
|
|
98 |
|
|
JIS X 0201:1997 6.2 7-bit code for Katakana |
99 |
|
|
(Alias: JIS_C6220-1969-jp (RFC 1345), JIS_C6220-1969 (RFC 1345), |
100 |
wakaba |
1.4 |
iso-ir-13 (RFC 1345), ir13, katakana (RFC 1345), x0201-7 (RFC 1345), |
101 |
wakaba |
1.1 |
csISO13JISC6220jp (IANA)) |
102 |
|
|
|
103 |
|
|
=cut |
104 |
|
|
|
105 |
|
|
sub __2022__common ($) { |
106 |
|
|
my $C = shift->SUPER::__2022__common; |
107 |
|
|
$C->{bit} = 7; |
108 |
|
|
$C->{G0} = $Encode::ISO2022::CHARSET{G94}->{I}; ## JIS X 0201:1997 Katakana set |
109 |
wakaba |
1.4 |
$C->{G1} = $C->{G0}; $C->{G2} = $C->{G1}; ## RFC 1345 (not in JIS) |
110 |
|
|
$C->{G3} = $C->{G1}; |
111 |
wakaba |
1.1 |
$C->{option}->{undef_char} = ["\x25", {type => 'G94', charset => 'I'}]; |
112 |
|
|
$C; |
113 |
|
|
} |
114 |
|
|
|
115 |
wakaba |
1.2 |
package Encode::ISO2022::JIS::JISX0201LatinKatakana7; |
116 |
wakaba |
1.1 |
use vars qw/@ISA/; |
117 |
|
|
push @ISA, 'Encode::ISO2022::JIS'; |
118 |
|
|
__PACKAGE__->Define (qw/jisx0201-1997-latin-katakana-7bit |
119 |
|
|
JIS_X0201 X0201 csHalfWidthKatakana/); |
120 |
|
|
|
121 |
|
|
=item jisx0201-1997-latin-katakana-7bit |
122 |
|
|
|
123 |
|
|
JIS X 0201:1997 6.3 7-bit code for Latin and Katakana |
124 |
|
|
(Alias: JIS_X0201 (RFC 1345), X0201 (RFC 1345), csHalfWidthKatakana (IANA)) |
125 |
|
|
|
126 |
|
|
=cut |
127 |
|
|
|
128 |
|
|
sub __2022__common ($) { |
129 |
|
|
my $C = shift->SUPER::__2022__common; |
130 |
|
|
$C->{bit} = 7; |
131 |
|
|
$C->{G0} = $Encode::ISO2022::CHARSET{G94}->{J}; ## JIS X 0201:1997 Latin set |
132 |
|
|
$C->{G1} = $Encode::ISO2022::CHARSET{G94}->{I}; ## JIS X 0201:1997 Katakana set |
133 |
|
|
$C->{option}->{Ginvoke_to_left} = [1,1,1,1]; |
134 |
|
|
$C->{option}->{reset}->{Ginvoke} = 1; |
135 |
|
|
## JIS X 0201:1997 does not specify this limitation. |
136 |
|
|
$C->{option}->{undef_char} = ["\x3F", {type => 'G94', charset => 'J'}]; |
137 |
|
|
$C; |
138 |
|
|
} |
139 |
|
|
sub __2022_encode ($) { |
140 |
|
|
my $C = shift->__2022__common; |
141 |
|
|
$C->{GR} = undef; |
142 |
|
|
$C; |
143 |
|
|
} |
144 |
|
|
|
145 |
wakaba |
1.2 |
package Encode::ISO2022::JIS::JISX0201LatinKatakana8; |
146 |
wakaba |
1.1 |
use vars qw/@ISA/; |
147 |
|
|
push @ISA, 'Encode::ISO2022::JIS'; |
148 |
wakaba |
1.6 |
__PACKAGE__->Define (qw/jisx0201-1997-latin-latin-8bit kana8/); |
149 |
wakaba |
1.1 |
|
150 |
|
|
=item jisx0201-1997-latin-katakana-8bit |
151 |
|
|
|
152 |
|
|
JIS X 0208:1997 7.4 8-bit code for Latin and Katakana |
153 |
|
|
|
154 |
|
|
=cut |
155 |
|
|
|
156 |
|
|
sub __2022__common ($) { |
157 |
|
|
my $C = shift->SUPER::__2022__common; |
158 |
|
|
$C->{bit} = 8; |
159 |
|
|
$C->{G0} = $Encode::ISO2022::CHARSET{G94}->{J}; ## JIS X 0201:1997 Latin set |
160 |
|
|
$C->{G1} = $Encode::ISO2022::CHARSET{G94}->{I}; ## JIS X 0201:1997 Katakana set |
161 |
|
|
$C->{option}->{undef_char} = ["\x3F", {type => 'G94', charset => 'J'}]; |
162 |
wakaba |
1.2 |
$C->{option}->{C1invoke_to_right} = 1; |
163 |
wakaba |
1.1 |
$C; |
164 |
|
|
} |
165 |
|
|
|
166 |
wakaba |
1.2 |
package Encode::ISO2022::JIS::JISX0208Kanji7; |
167 |
wakaba |
1.1 |
use vars qw/@ISA/; |
168 |
|
|
push @ISA, 'Encode::ISO2022::JIS'; |
169 |
|
|
__PACKAGE__->Define (qw/jisx0208-1997-kanji-7bit/); |
170 |
|
|
|
171 |
|
|
=item jisx0208-1997-kanji-7bit |
172 |
|
|
|
173 |
|
|
JIS X 0208:1997 7.1.1 7-bit code for Kanji |
174 |
|
|
|
175 |
|
|
=cut |
176 |
|
|
|
177 |
|
|
sub __2022__common ($) { |
178 |
|
|
my $C = shift->SUPER::__2022__common; |
179 |
|
|
$C->{bit} = 7; |
180 |
|
|
$C->{G0} = $Encode::ISO2022::CHARSET{G94n}->{'B@'}; ## JIS X 0208:1997 |
181 |
|
|
$C; |
182 |
|
|
} |
183 |
|
|
|
184 |
wakaba |
1.2 |
package Encode::ISO2022::JIS::JISX0208Kanji8; |
185 |
wakaba |
1.1 |
use vars qw/@ISA/; |
186 |
|
|
push @ISA, 'Encode::ISO2022::JIS'; |
187 |
|
|
__PACKAGE__->Define (qw/jisx0208-1997-kanji-8bit/); |
188 |
|
|
|
189 |
|
|
=item jisx0208-1997-kanji-8bit |
190 |
|
|
|
191 |
|
|
JIS X 0208:1997 7.1.2 8-bit code for Kanji |
192 |
|
|
|
193 |
|
|
=cut |
194 |
|
|
|
195 |
|
|
sub __2022__common ($) { |
196 |
|
|
my $C = shift->SUPER::__2022__common; |
197 |
|
|
$C->{bit} = 8; |
198 |
|
|
$C->{G0} = $Encode::ISO2022::CHARSET{G94n}->{'B@'}; ## JIS X 0208:1997 |
199 |
|
|
$C->{G1} = $Encode::ISO2022::CHARSET{G94}->{"\x7E"}; ## empty |
200 |
|
|
$C->{option}->{C1invoke_to_right} = 1; |
201 |
|
|
$C; |
202 |
|
|
} |
203 |
|
|
|
204 |
wakaba |
1.2 |
package Encode::ISO2022::JIS::JISX0208IRVKanji7; |
205 |
wakaba |
1.1 |
use vars qw/@ISA/; |
206 |
|
|
push @ISA, 'Encode::ISO2022::JIS'; |
207 |
|
|
__PACKAGE__->Define (qw/jisx0208-1997-irv-kanji-7bit/); |
208 |
|
|
|
209 |
|
|
=item jisx0208-1997-irv-kanji-7bit |
210 |
|
|
|
211 |
|
|
JIS X 0208:1997 7.2.1 7-bit code for IRV and Kanji |
212 |
|
|
|
213 |
|
|
=cut |
214 |
|
|
|
215 |
|
|
sub __2022__common ($) { |
216 |
|
|
my $C = shift->SUPER::__2022__common; |
217 |
|
|
$C->{bit} = 7; |
218 |
|
|
$C->{G0} = $Encode::ISO2022::CHARSET{G94}->{B}; ## ISO/IEC 646 IRV |
219 |
|
|
$C->{G1} = $Encode::ISO2022::CHARSET{G94n}->{'B@'}; ## JIS X 0208:1997 |
220 |
|
|
$C->{option}->{Ginvoke_to_left} = [1,1,1,1]; |
221 |
|
|
$C->{option}->{reset}->{Ginvoke} = 1; |
222 |
|
|
## JIS X 0208:1997 does not specify this limitation. |
223 |
|
|
$C; |
224 |
|
|
} |
225 |
|
|
sub __2022_encode ($) { |
226 |
|
|
my $C = shift->__2022__common; |
227 |
|
|
$C->{GR} = undef; |
228 |
|
|
$C; |
229 |
|
|
} |
230 |
|
|
|
231 |
wakaba |
1.2 |
package Encode::ISO2022::JIS::JISX0208IRVKanji8; |
232 |
wakaba |
1.1 |
use vars qw/@ISA/; |
233 |
|
|
push @ISA, 'Encode::ISO2022::JIS'; |
234 |
|
|
__PACKAGE__->Define (qw/jisx0208-1997-irv-kanji-8bit/); |
235 |
|
|
|
236 |
|
|
=item jisx0208-1997-irv-kanji-8bit |
237 |
|
|
|
238 |
|
|
JIS X 0208:1997 7.2.2 8-bit code for IRV and Kanji. |
239 |
|
|
(A subset of EUC-japan) |
240 |
|
|
|
241 |
|
|
=cut |
242 |
|
|
|
243 |
|
|
sub __2022__common ($) { |
244 |
|
|
my $C = shift->SUPER::__2022__common; |
245 |
|
|
$C->{bit} = 8; |
246 |
|
|
$C->{G0} = $Encode::ISO2022::CHARSET{G94}->{B}; ## ISO/IEC 646 IRV |
247 |
|
|
$C->{G1} = $Encode::ISO2022::CHARSET{G94n}->{'B@'}; ## JIS X 0208:1997 |
248 |
wakaba |
1.2 |
$C->{option}->{C1invoke_to_right} = 1; |
249 |
wakaba |
1.1 |
$C; |
250 |
|
|
} |
251 |
|
|
|
252 |
wakaba |
1.2 |
package Encode::ISO2022::JIS::JISX0208LatinKanji7; |
253 |
wakaba |
1.1 |
use vars qw/@ISA/; |
254 |
|
|
push @ISA, 'Encode::ISO2022::JIS'; |
255 |
|
|
__PACKAGE__->Define (qw/jisx0208-1997-latin-kanji-7bit/); |
256 |
|
|
|
257 |
|
|
=item jisx0208-1997-latin-kanji-7bit |
258 |
|
|
|
259 |
|
|
JIS X 0208:1997 7.3.1 7-bit code for Latin and Kanji |
260 |
|
|
|
261 |
|
|
=cut |
262 |
|
|
|
263 |
|
|
sub __2022__common ($) { |
264 |
|
|
my $C = shift->SUPER::__2022__common; |
265 |
|
|
$C->{bit} = 7; |
266 |
|
|
$C->{G0} = $Encode::ISO2022::CHARSET{G94}->{J}; ## JIS X 0201:1997 Latin set |
267 |
|
|
$C->{G1} = $Encode::ISO2022::CHARSET{G94n}->{'B@'}; ## JIS X 0208:1997 |
268 |
|
|
$C->{option}->{Ginvoke_to_left} = [1,1,1,1]; |
269 |
|
|
$C->{option}->{reset}->{Ginvoke} = 1; |
270 |
|
|
## JIS X 0208:1997 does not specify this limitation. |
271 |
|
|
$C; |
272 |
|
|
} |
273 |
|
|
sub __2022_encode ($) { |
274 |
|
|
my $C = shift->__2022__common; |
275 |
|
|
$C->{GR} = undef; |
276 |
|
|
$C; |
277 |
|
|
} |
278 |
|
|
|
279 |
wakaba |
1.2 |
package Encode::ISO2022::JIS::JISX0208LatinKanji8; |
280 |
wakaba |
1.1 |
use vars qw/@ISA/; |
281 |
|
|
push @ISA, 'Encode::ISO2022::JIS'; |
282 |
|
|
__PACKAGE__->Define (qw/jisx0208-1997-latin-kanji-8bit/); |
283 |
|
|
|
284 |
|
|
=item jisx0208-1997-latin-kanji-8bit |
285 |
|
|
|
286 |
|
|
JIS X 0208:1997 7.2.2 8-bit code for Latin and Kanji |
287 |
|
|
|
288 |
|
|
=cut |
289 |
|
|
|
290 |
|
|
sub __2022__common ($) { |
291 |
|
|
my $C = shift->SUPER::__2022__common; |
292 |
|
|
$C->{bit} = 8; |
293 |
|
|
$C->{G0} = $Encode::ISO2022::CHARSET{G94}->{J}; ## JIS X 0201:1997 Latin set |
294 |
|
|
$C->{G1} = $Encode::ISO2022::CHARSET{G94n}->{'B@'}; ## JIS X 0208:1997 |
295 |
wakaba |
1.2 |
$C->{option}->{C1invoke_to_right} = 1; |
296 |
wakaba |
1.1 |
$C; |
297 |
|
|
} |
298 |
|
|
|
299 |
wakaba |
1.2 |
package Encode::ISO2022::JIS::JISX0213Kanji7; |
300 |
wakaba |
1.1 |
use vars qw/@ISA/; |
301 |
|
|
push @ISA, 'Encode::ISO2022::JIS'; |
302 |
|
|
__PACKAGE__->Define (qw/jisx0213-2000-kanji-7bit/); |
303 |
|
|
|
304 |
|
|
=item jisx0213-2000-kanji-7bit |
305 |
|
|
|
306 |
|
|
JIS X 0213:2000 7.1.1 7-bit code for Kanji |
307 |
|
|
|
308 |
|
|
=cut |
309 |
|
|
|
310 |
|
|
sub __2022__common ($) { |
311 |
|
|
my $C = shift->SUPER::__2022__common; |
312 |
|
|
$C->{bit} = 7; |
313 |
|
|
$C->{G0} = $Encode::ISO2022::CHARSET{G94n}->{O}; ## plane 1 |
314 |
|
|
$C->{G1} = $Encode::ISO2022::CHARSET{G94n}->{P}; ## plane 2 |
315 |
|
|
$C->{option}->{Ginvoke_to_left} = [1,1,1,1]; |
316 |
|
|
$C->{option}->{reset}->{Ginvoke} = 1; |
317 |
|
|
## JIS X 0213:2000 does not specify this limitation. |
318 |
|
|
$C->{option}->{undef_char} = ["\x22\x2E", {type => 'G94n', charset => 'O'}]; |
319 |
|
|
$C; |
320 |
|
|
} |
321 |
|
|
sub __2022_encode ($) { |
322 |
|
|
my $C = shift->__2022__common; |
323 |
|
|
$C->{GR} = undef; |
324 |
|
|
$C; |
325 |
|
|
} |
326 |
|
|
|
327 |
wakaba |
1.2 |
package Encode::ISO2022::JIS::JISX0213Kanji8; |
328 |
wakaba |
1.1 |
use vars qw/@ISA/; |
329 |
|
|
push @ISA, 'Encode::ISO2022::JIS'; |
330 |
|
|
__PACKAGE__->Define (qw/jisx0213-2000-kanji-8bit/); |
331 |
|
|
|
332 |
|
|
=item jisx0213-2000-kanji-8bit |
333 |
|
|
|
334 |
|
|
JIS X 0213:2000 7.1.2 8-bit code for Kanji |
335 |
|
|
|
336 |
|
|
=cut |
337 |
|
|
|
338 |
|
|
sub __2022__common ($) { |
339 |
|
|
my $C = shift->SUPER::__2022__common; |
340 |
|
|
$C->{bit} = 7; |
341 |
|
|
$C->{G0} = $Encode::ISO2022::CHARSET{G94n}->{O}; ## plane 1 |
342 |
|
|
$C->{G1} = $Encode::ISO2022::CHARSET{G94n}->{P}; ## plane 2 |
343 |
|
|
$C->{option}->{undef_char} = ["\x22\x2E", {type => 'G94n', charset => 'O'}]; |
344 |
wakaba |
1.2 |
$C->{option}->{C1invoke_to_right} = 1; |
345 |
wakaba |
1.1 |
$C; |
346 |
|
|
} |
347 |
|
|
|
348 |
wakaba |
1.2 |
package Encode::ISO2022::JIS::JISX0213IRVKanji7; |
349 |
wakaba |
1.1 |
use vars qw/@ISA/; |
350 |
|
|
push @ISA, 'Encode::ISO2022::JIS'; |
351 |
|
|
__PACKAGE__->Define (qw/jisx0213-2000-irv-kanji-7bit/); |
352 |
|
|
|
353 |
|
|
=item jisx0213-2000-irv-kanji-7bit |
354 |
|
|
|
355 |
|
|
JIS X 0213:2000 7.2.1 7-bit code for IRV and Kanji |
356 |
|
|
|
357 |
|
|
=cut |
358 |
|
|
|
359 |
|
|
sub __2022__common ($) { |
360 |
|
|
my $C = shift->SUPER::__2022__common; |
361 |
|
|
$C->{bit} = 7; |
362 |
|
|
$C->{G0} = $Encode::ISO2022::CHARSET{G94}->{B}; ## ISO/IEC 646 IRV |
363 |
|
|
$C->{G1} = $Encode::ISO2022::CHARSET{G94n}->{O}; ## plane 1 |
364 |
|
|
$C->{G3} = $Encode::ISO2022::CHARSET{G94n}->{P}; ## plane 2 |
365 |
|
|
$C->{option}->{Ginvoke_by_single_shift}->[3] = 1; |
366 |
|
|
$C->{option}->{Ginvoke_to_left} = [1,1,1,1]; |
367 |
|
|
$C->{option}->{reset}->{Ginvoke} = 1; |
368 |
|
|
## JIS X 0213:2000 does not specify this limitation. |
369 |
|
|
$C->{option}->{undef_char} = ["\x22\x2E", {type => 'G94n', charset => 'O'}]; |
370 |
|
|
$C; |
371 |
|
|
} |
372 |
|
|
sub __2022_encode ($) { |
373 |
|
|
my $C = shift->__2022__common; |
374 |
|
|
$C->{GR} = undef; |
375 |
|
|
$C; |
376 |
|
|
} |
377 |
|
|
|
378 |
wakaba |
1.2 |
package Encode::ISO2022::JIS::JISX0213IRVKanji8; |
379 |
wakaba |
1.1 |
use vars qw/@ISA/; |
380 |
|
|
push @ISA, 'Encode::ISO2022::JIS'; |
381 |
|
|
__PACKAGE__->Define (qw/jisx0213-2000-irv-kanji-8bit/); |
382 |
|
|
|
383 |
|
|
=item jisx0213-2000-irv-kanji-8bit |
384 |
|
|
|
385 |
|
|
JIS X 0213:2000 7.2.2 8-bit code for IRV and Kanji. |
386 |
|
|
(A subset of EUC-JISX0213) |
387 |
|
|
|
388 |
|
|
=cut |
389 |
|
|
|
390 |
|
|
sub __2022__common ($) { |
391 |
|
|
my $C = shift->SUPER::__2022__common; |
392 |
|
|
$C->{bit} = 8; |
393 |
|
|
$C->{G0} = $Encode::ISO2022::CHARSET{G94}->{B}; ## ISO/IEC 646 IRV |
394 |
|
|
$C->{G1} = $Encode::ISO2022::CHARSET{G94n}->{O}; ## plane 1 |
395 |
|
|
$C->{G3} = $Encode::ISO2022::CHARSET{G94n}->{P}; ## plane 2 |
396 |
|
|
$C->{option}->{Ginvoke_by_single_shift}->[3] = 1; |
397 |
|
|
$C->{option}->{Ginvoke_to_left} = [1,0,0,0]; |
398 |
|
|
$C->{option}->{undef_char} = ["\x22\x2E", {type => 'G94n', charset => 'O'}]; |
399 |
wakaba |
1.2 |
$C->{option}->{C1invoke_to_right} = 1; |
400 |
wakaba |
1.1 |
$C; |
401 |
|
|
} |
402 |
|
|
|
403 |
wakaba |
1.2 |
package Encode::ISO2022::JIS::JISX0213LatinKanji7; |
404 |
wakaba |
1.1 |
use vars qw/@ISA/; |
405 |
|
|
push @ISA, 'Encode::ISO2022::JIS'; |
406 |
|
|
__PACKAGE__->Define (qw/jisx0213-2000-latin-kanji-7bit/); |
407 |
|
|
|
408 |
|
|
=item jisx0213-2000-latin-kanji-7bit |
409 |
|
|
|
410 |
|
|
JIS X 0213:2000 7.3.1 7-bit code for Latin and Kanji |
411 |
|
|
|
412 |
|
|
=cut |
413 |
|
|
|
414 |
|
|
sub __2022__common ($) { |
415 |
|
|
my $C = shift->SUPER::__2022__common; |
416 |
|
|
$C->{bit} = 7; |
417 |
|
|
$C->{G0} = $Encode::ISO2022::CHARSET{G94}->{J}; ## JIS X 0201:1997 Latin set |
418 |
|
|
$C->{G1} = $Encode::ISO2022::CHARSET{G94n}->{O}; ## plane 1 |
419 |
|
|
$C->{G3} = $Encode::ISO2022::CHARSET{G94n}->{P}; ## plane 2 |
420 |
|
|
$C->{option}->{Ginvoke_by_single_shift}->[3] = 1; |
421 |
|
|
$C->{option}->{Ginvoke_to_left} = [1,1,1,1]; |
422 |
|
|
$C->{option}->{reset}->{Ginvoke} = 1; |
423 |
|
|
## JIS X 0213:2000 does not specify this limitation. |
424 |
|
|
$C->{option}->{undef_char} = ["\x22\x2E", {type => 'G94n', charset => 'O'}]; |
425 |
|
|
$C; |
426 |
|
|
} |
427 |
|
|
sub __2022_encode ($) { |
428 |
|
|
my $C = shift->__2022__common; |
429 |
|
|
$C->{GR} = undef; |
430 |
|
|
$C; |
431 |
|
|
} |
432 |
|
|
|
433 |
wakaba |
1.2 |
package Encode::ISO2022::JIS::JISX0213LatinKanji8; |
434 |
wakaba |
1.1 |
use vars qw/@ISA/; |
435 |
|
|
push @ISA, 'Encode::ISO2022::JIS'; |
436 |
|
|
__PACKAGE__->Define (qw/jisx0213-2000-latin-kanji-8bit/); |
437 |
|
|
|
438 |
|
|
=item jisx0213-2000-latin-kanji-8bit |
439 |
|
|
|
440 |
|
|
JIS X 0213:2000 7.2.2 8-bit code for Latin and Kanji |
441 |
|
|
|
442 |
|
|
=cut |
443 |
|
|
|
444 |
|
|
sub __2022__common ($) { |
445 |
|
|
my $C = shift->SUPER::__2022__common; |
446 |
|
|
$C->{bit} = 8; |
447 |
|
|
$C->{G0} = $Encode::ISO2022::CHARSET{G94}->{J}; ## JIS X 0201:1997 Latin set |
448 |
|
|
$C->{G1} = $Encode::ISO2022::CHARSET{G94n}->{O}; ## plane 1 |
449 |
|
|
$C->{G3} = $Encode::ISO2022::CHARSET{G94n}->{P}; ## plane 2 |
450 |
|
|
$C->{option}->{Ginvoke_by_single_shift}->[3] = 1; |
451 |
|
|
$C->{option}->{Ginvoke_to_left} = [1,0,0,0]; |
452 |
|
|
$C->{option}->{undef_char} = ["\x22\x2E", {type => 'G94n', charset => 'O'}]; |
453 |
wakaba |
1.2 |
$C->{option}->{C1invoke_to_right} = 1; |
454 |
|
|
$C; |
455 |
|
|
} |
456 |
|
|
|
457 |
|
|
package Encode::ISO2022::JIS::JISX4001Text7; |
458 |
|
|
use vars qw/@ISA/; |
459 |
|
|
push @ISA, 'Encode::ISO2022::JIS'; |
460 |
|
|
__PACKAGE__->Define (qw/jisx4001-text-7bit/); |
461 |
|
|
|
462 |
|
|
=item jisx4001-text-7bit |
463 |
|
|
|
464 |
|
|
JIS X 4001-1989 text (7-bit code) |
465 |
|
|
|
466 |
|
|
=cut |
467 |
|
|
|
468 |
|
|
sub __2022__common ($) { |
469 |
|
|
my $C = shift->SUPER::__2022__common; |
470 |
|
|
$C->{bit} = 7; |
471 |
|
|
$C->{G0} = $Encode::ISO2022::CHARSET{G94n}->{B}; ## JIS X 0208-1983 |
472 |
|
|
$C->{option}->{designate_to}->{G94}->{J} = 0; ## JIS X 0201 Roman |
473 |
|
|
$C->{option}->{designate_to}->{G94n}->{B} = 0; ## JIS X 0208-1983 |
474 |
|
|
$C; |
475 |
|
|
} |
476 |
|
|
|
477 |
|
|
package Encode::ISO2022::JIS::JISX4001Text8; |
478 |
|
|
use vars qw/@ISA/; |
479 |
|
|
push @ISA, 'Encode::ISO2022::JIS::JISX4001Text7'; |
480 |
|
|
__PACKAGE__->Define (qw/jisx4001-text-8bit/); |
481 |
|
|
|
482 |
|
|
=item jisx4001-text-8bit |
483 |
|
|
|
484 |
|
|
JIS X 4001-1989 text (8-bit code) |
485 |
|
|
|
486 |
|
|
=cut |
487 |
|
|
|
488 |
|
|
sub __2022__common ($) { |
489 |
|
|
my $C = shift->SUPER::__2022__common; |
490 |
|
|
$C->{bit} = 7; |
491 |
|
|
$C->{option}->{C1invoke_to_right} = 1; |
492 |
wakaba |
1.1 |
$C; |
493 |
|
|
} |
494 |
|
|
|
495 |
|
|
1; |
496 |
|
|
__END__ |
497 |
|
|
|
498 |
|
|
=back |
499 |
|
|
|
500 |
|
|
Note that although other JISes such as JIS X 0212 and JIS X 9010 |
501 |
|
|
define ISO/IEC 2022-comfprming coded character sets, |
502 |
|
|
these standards do not define complete coding system (but define |
503 |
|
|
as used on ISO/IEC 2022 environment), so this module |
504 |
|
|
does not include those coded character sets. (IETF RFC 1345 |
505 |
|
|
and IANAREG give charset name to coded character sets |
506 |
|
|
consist of such standards. But those are defined by RFC 1345, |
507 |
|
|
not by JIS. Such coded character sets should be implemented |
508 |
|
|
in Encode::ISO2022::RFC1345.) |
509 |
|
|
|
510 |
|
|
=head1 LICENSE |
511 |
|
|
|
512 |
wakaba |
1.3 |
Copyright 2002 Wakaba <w@suika.fam.cx> |
513 |
wakaba |
1.1 |
|
514 |
|
|
This library is free software; you can redistribute it |
515 |
|
|
and/or modify it under the same terms as Perl itself. |
516 |
|
|
|
517 |
|
|
=cut |
518 |
|
|
|
519 |
wakaba |
1.6 |
# $Date: 2002/10/12 07:27:01 $ |
520 |
wakaba |
1.1 |
### JIS.pm ends here |