1 package Encode::KR::2022_KR;
2 use Encode qw(:fallbacks);
3 use base 'Encode::Encoding';
7 our $VERSION = do { my @r = (q$Revision: 1.4 $ =~ /\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}; }
19 return 0; # for the time being
24 my ($obj, $str, $chk) = @_;
26 my $residue = iso_euc(\$res);
28 $_[1] = $residue if $chk;
29 return Encode::decode('euc-kr', $res, FB_PERLQQ);
34 my ($obj, $utf8, $chk) = @_;
35 # empty the input string in the stack so perlio is ok
37 my $octet = Encode::encode('euc-jp', $utf8, FB_PERLQQ) ;
42 use Encode::CJKConstants qw(:all);
48 $$r_str =~ s/$RE{'2022_KR'}//gox; # remove the designator
49 $$r_str =~ s{ # replace characters in GL
50 \x0e # between SO(\x0e) and SI(\x0f)
51 ([^\x0f]*) # with characters in GR
56 $out =~ tr/\x21-\x7e/\xa1-\xfe/;
59 my ($residue) = ($$r_str =~ s/(\e.*)$//so);
64 no warnings qw(uninitialized);
66 substr($$r_str,0,0)=$ESC{'2022_KR'}; # put the designator at the beg.
67 $$r_str =~ s{ # move KS X 1001 characters in GR to GL
68 ($RE{EUC_C}+) # and enclose them with SO and SI
71 $str =~ tr/\xA1-\xFE/\x21-\x7E/;
72 "\x0e" . $str . "\x0f";
82 Encode::KR::2022_KR -- internally used by Encode::KR