diff options
author | Inaba Hiroto <inaba@st.rim.or.jp> | 2003-02-02 06:58:20 +0900 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2003-02-05 17:15:35 +0000 |
commit | 220e2d4e806a3c9c0a9f9b31667e8be830cbc55b (patch) | |
tree | 28905af26db33e5aba4ebee2d01aafaecdd67261 /ext/Encode/Encode.pm | |
parent | 6efa47225d75a7e88a5d03044ee492ff6e1b7ee0 (diff) | |
download | perl-220e2d4e806a3c9c0a9f9b31667e8be830cbc55b.tar.gz |
[Patch] parsing under encoding (Re: [Encode] HEADS-UP; $Encode::VERSION++ to enhance filter option)([perl #16823])
Message-ID: <3E3BC46B.6C687CFD@st.rim.or.jp>
p4raw-id: //depot/perl@18660
Diffstat (limited to 'ext/Encode/Encode.pm')
-rw-r--r-- | ext/Encode/Encode.pm | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/ext/Encode/Encode.pm b/ext/Encode/Encode.pm index c85cbbedbb..548c5ab986 100644 --- a/ext/Encode/Encode.pm +++ b/ext/Encode/Encode.pm @@ -271,6 +271,19 @@ sub predefine_encodings{ return $octets; }; } + *cat_decode = sub{ # ($obj, $dst, $src, $pos, $trm, $chk) + my ($obj, undef, undef, $pos, $trm) = @_; # currently ignores $chk + my ($rdst, $rsrc, $rpos) = \@_[1,2,3]; + use bytes; + if ((my $npos = index($$rsrc, $trm, $pos)) >= 0) { + $$rdst .= substr($$rsrc, $pos, $npos - $pos + length($trm)); + $$rpos = $npos + length($trm); + return 1; + } + $$rdst .= substr($$rsrc, $pos); + $$rpos = length($$rsrc); + return ''; + }; $Encode::Encoding{utf8} = bless {Name => "utf8"} => "Encode::utf8"; } |