1 package Encode::JP::JIS;
3 use base 'Encode::Encoding';
8 $VERSION = do { my @r = (q$Revision: 0.98 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
10 # Just for the time being, we implement jis-7bit
13 my $canon = '7bit-jis';
14 my $obj = bless {name => $canon}, __PACKAGE__;
17 sub name { return $_[0]->{name}; }
21 my ($obj,$str,$chk) = @_;
24 return Encode::decode('euc-jp', $res, $chk);
29 my ($obj,$str,$chk) = @_;
30 my $res = Encode::encode('euc-jp', $str, $chk);
35 use Encode::JP::Constants qw(:all);
42 ($RE{JIS_0212}|$RE{JIS_0208}|$RE{JIS_ASC}|$RE{JIS_KANA})
46 my ($esc, $str) = ($1, $2);
47 if ($esc !~ /$RE{JIS_ASC}/o) {
48 $str =~ tr/\x21-\x7e/\xa1-\xfe/;
49 if ($esc =~ /$RE{JIS_KANA}/o) {
50 $str =~ s/([\xa1-\xdf])/\x8e$1/og;
52 elsif ($esc =~ /$RE{JIS_0212}/o) {
53 $str =~ s/([\xa1-\xfe][\xa1-\xfe])/\x8f$1/og;
64 ((?:$RE{EUC_C})+|(?:$RE{EUC_KANA})+|(?:$RE{EUC_0212})+)
68 ( $str =~ tr/\x8E//d ) ? $ESC{KANA} :
69 ( $str =~ tr/\x8F//d ) ? $ESC{JIS_0212} :
71 $str =~ tr/\xA1-\xFE/\x21-\x7E/;
72 $esc . $str . $ESC{ASC};
76 (\Q$ESC{KANA}\E|\Q$ESC{JIS_0212}\E|\Q$ESC{JIS_0208}\E)/$1/gox;
82 $$r_str =~ s/$RE{EUC_0212}/$CHARCODE{UNDEF_EUC}/go;