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
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
7 use vars qw($VERSION);
8 $VERSION = 0.01;
9
10 my $canon = 'iso-2022-jp';
11 my $obj = bless {name => $canon}, __PACKAGE__;
12 $obj->Define($canon);
13
14 #
15 # decode is identical to 7bit-jis
16 #
17
18 sub 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
27 sub 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
35 1;
36 __END__