Upgrade to Encode 0.98, from Dan Kogai.
[p5sagit/p5-mst-13.2.git] / ext / Encode / lib / Encode / JP / ISO_2022_JP.pm
CommitLineData
0e567a6c 1package Encode::JP::ISO_2022_JP;
2use Encode::JP;
3use Encode::JP::JIS;
4use Encode::JP::H2Z;
5use base 'Encode::Encoding';
6
eb042f38 7use vars qw($VERSION);
a63c962f 8$VERSION = do { my @r = (q$Revision: 0.98 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
0e567a6c 9
10my $canon = 'iso-2022-jp';
11my $obj = bless {name => $canon}, __PACKAGE__;
12$obj->Define($canon);
13
1b2c56c8 14sub name { return $_[0]->{name}; }
15
0e567a6c 16#
17# decode is identical to 7bit-jis
18#
19
20sub 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
29sub 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
371;
38__END__