This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
VERSIONize.
[perl5.git] / ext / Encode / lib / Encode / JP / ISO_2022_JP.pm
CommitLineData
0e567a6c
JH
1package Encode::JP::ISO_2022_JP;
2use Encode::JP;
3use Encode::JP::JIS;
4use Encode::JP::H2Z;
5use base 'Encode::Encoding';
6
eb042f38
JH
7use vars qw($VERSION);
8$VERSION = 0.01;
0e567a6c
JH
9
10my $canon = 'iso-2022-jp';
11my $obj = bless {name => $canon}, __PACKAGE__;
12$obj->Define($canon);
13
14#
15# decode is identical to 7bit-jis
16#
17
18sub decode
19{
20 my ($obj,$str,$chk) = @_;
21 return Encode::decode('7bit-jis', $str, $chk);
22}
23
24# iso-2022-jp = 7bit-jis with all x201 (Hankaku) converted to
25# x208 equivalent (Zenkaku)
26
27sub encode
28{
29 my ($obj,$str,$chk) = @_;
30 my $euc = Encode::encode('euc-jp', $str, $chk);
31 &Encode::JP::H2Z::h2z(\$euc);
32 return &Encode::JP::JIS::euc_jis(\$euc);
33}
34
351;
36__END__