1 package Encode::KR::2022_KR;
3 use base 'Encode::Encoding';
7 our $VERSION = do { my @r = (q$Revision: 1.2 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
10 my $canon = 'iso-2022-kr';
11 my $obj = bless {name => $canon}, __PACKAGE__;
14 sub name { return $_[0]->{name}; }
20 my ($obj,$str,$chk) = @_;
23 return Encode::decode('euc-kr', $res, $chk);
28 my ($obj,$str,$chk) = @_;
29 my $res = Encode::encode('euc-kr', $str, $chk);
34 use Encode::CJKConstants qw(:all);
40 $$r_str =~ s/$RE{'2022_KR'}//gox; # remove the designator
41 $$r_str =~ s{ # replace chars. in GL
42 \x0e # between SO(\x0e) and SI(\x0f)
43 ([^\x0f]*) # with chars. in GR
48 $out =~ tr/\x21-\x7e/\xa1-\xfe/;
56 substr($$r_str,0,0)=$ESC{'2022_KR'}; # put the designator at the beg.
57 $$r_str =~ s{ # move KS X 1001 chars. in GR to GL
58 ($RE{EUC_C}+) # and enclose them with SO and SI
61 $str =~ tr/\xA1-\xFE/\x21-\x7E/;
62 "\x0e" . $str . "\x0f";
72 Encode::KR::2022_KR -- internally used by Encode::KR