Commit | Line | Data |
0e567a6c |
1 | package Encode::JP::ISO_2022_JP; |
2 | use Encode::JP; |
3 | use Encode::JP::JIS; |
4 | use Encode::JP::H2Z; |
5 | use base 'Encode::Encoding'; |
6 | |
eb042f38 |
7 | use vars qw($VERSION); |
a63c962f |
8 | $VERSION = do { my @r = (q$Revision: 0.98 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; |
0e567a6c |
9 | |
10 | my $canon = 'iso-2022-jp'; |
11 | my $obj = bless {name => $canon}, __PACKAGE__; |
12 | $obj->Define($canon); |
13 | |
1b2c56c8 |
14 | sub name { return $_[0]->{name}; } |
15 | |
0e567a6c |
16 | # |
17 | # decode is identical to 7bit-jis |
18 | # |
19 | |
20 | sub decode |
21 | { |
22 | my ($obj,$str,$chk) = @_; |
23 | return Encode::decode('7bit-jis', $str, $chk); |
24 | } |
25 | |
26 | # iso-2022-jp = 7bit-jis with all x201 (Hankaku) converted to |
27 | # x208 equivalent (Zenkaku) |
28 | |
29 | sub encode |
30 | { |
31 | my ($obj,$str,$chk) = @_; |
32 | my $euc = Encode::encode('euc-jp', $str, $chk); |
33 | &Encode::JP::H2Z::h2z(\$euc); |
a63c962f |
34 | return &Encode::JP::JIS::euc_jis_nox0212(\$euc); |
0e567a6c |
35 | } |
36 | |
37 | 1; |
38 | __END__ |