1
package Encode::KR::2022_KR;
4
our $VERSION = do { my @r = ( q$Revision: 2.2 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r };
6
use Encode qw(:fallbacks);
8
use base qw(Encode::Encoding);
9
__PACKAGE__->Define('iso-2022-kr');
14
return 0; # for the time being
18
my ( $obj, $str, $chk ) = @_;
20
my $residue = iso_euc( \$res );
23
$_[1] = $residue if $chk;
24
return Encode::decode( 'euc-kr', $res, FB_PERLQQ );
28
my ( $obj, $utf8, $chk ) = @_;
30
# empty the input string in the stack so perlio is ok
32
my $octet = Encode::encode( 'euc-kr', $utf8, FB_PERLQQ );
37
use Encode::CJKConstants qw(:all);
43
$$r_str =~ s/$RE{'2022_KR'}//gox; # remove the designator
44
$$r_str =~ s{ # replace characters in GL
45
\x0e # between SO(\x0e) and SI(\x0f)
46
([^\x0f]*) # with characters in GR
51
$out =~ tr/\x21-\x7e/\xa1-\xfe/;
54
my ($residue) = ( $$r_str =~ s/(\e.*)$//so );
59
no warnings qw(uninitialized);
61
substr( $$r_str, 0, 0 ) =
62
$ESC{'2022_KR'}; # put the designator at the beg.
64
s{ # move KS X 1001 characters in GR to GL
65
($RE{EUC_C}+) # and enclose them with SO and SI
68
$str =~ tr/\xA1-\xFE/\x21-\x7E/;
69
"\x0e" . $str . "\x0f";
79
Encode::KR::2022_KR -- internally used by Encode::KR