From: Rafael Garcia-Suarez Date: Tue, 29 May 2007 09:33:52 +0000 (+0000) Subject: Upgrade to Encode 2.22 X-Git-Tag: accepted/trunk/20130322.191538~15168 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7828f908b176de6cfbabc3077a4131cab72a7cb3;p=platform%2Fupstream%2Fperl.git Upgrade to Encode 2.22 p4raw-id: //depot/perl@31305 --- diff --git a/ext/Encode/Changes b/ext/Encode/Changes index 0d3d9a4..1611254 100644 --- a/ext/Encode/Changes +++ b/ext/Encode/Changes @@ -1,8 +1,35 @@ # Revision history for Perl extension Encode. # -# $Id: Changes,v 2.20 2007/04/22 14:56:12 dankogai Exp dankogai $ +# $Id: Changes,v 2.22 2007/05/29 07:35:27 dankogai Exp dankogai $ # -$Revision: 2.20 $ $Date: 2007/04/22 14:56:12 $ +$Revision: 2.22 $ $Date: 2007/05/29 07:35:27 $ +! Encode.pm + from_to() does not honor the check while decoding. That's a feature. + To make sure it is a feature it is mentioned in the POD. + http://rt.cpan.org/NoAuth/Bug.html?id=#27277 +! Makefile.pl + Encode used to suppress man page generation. Now it does. + http://rt.cpan.org/NoAuth/Bug.html?id=#27200 +! Encode.pm Encode.xs t/fallback.t + Addressed: (de|en)code("ascii", "\x{3000}", sub{ $_[0] }) segfaults + Reported by MIYAGAWA + +2.21 2007/05/12 06:42:19 ++ lib/Encode/MIME/Name.pm t/mime-name.t +! Encode.pm Encode.xs lib/Encode/Encoding.pm + new method: mime_name() + inspired by: MIYAGAWA +! t/encoding.t + Subject: Re: Compress::Zlib, pack "C" and utf-8 [PATCH] + From: Marc Lehmann + Date: Thu, 12 Apr 2007 08:41:53 +0200 + Message-ID: <20070412064153.GA22475@schmorp.de> + http://public.activestate.com/cgi-bin/perlbrowse/p/31194 +! Unicode/Unicode.pm + POD fix. + Message-Id: <20070417220547.GA11999@zetta.zet> + +2.20 2007/04/22 14:56:12 ! Encode.pm Pod fixes. Now find_encoding() is explained more in details. + lib/Encode/GSM0338.pm diff --git a/ext/Encode/Encode.pm b/ext/Encode/Encode.pm index 74c7e3f..953bb56 100644 --- a/ext/Encode/Encode.pm +++ b/ext/Encode/Encode.pm @@ -1,10 +1,10 @@ # -# $Id: Encode.pm,v 2.21 2007/05/12 06:42:19 dankogai Exp dankogai $ +# $Id: Encode.pm,v 2.22 2007/05/29 07:35:27 dankogai Exp dankogai $ # package Encode; use strict; use warnings; -our $VERSION = sprintf "%d.%02d", q$Revision: 2.21 $ =~ /(\d+)/g; +our $VERSION = sprintf "%d.%02d", q$Revision: 2.22 $ =~ /(\d+)/g; sub DEBUG () { 0 } use XSLoader (); XSLoader::load( __PACKAGE__, $VERSION ); @@ -144,7 +144,7 @@ sub encode($$;$) { Carp::croak("Unknown encoding '$name'"); } my $octets = $enc->encode( $string, $check ); - $_[1] = $string if $check and !( $check & LEAVE_SRC() ); + $_[1] = $string if $check and !ref $check and !( $check & LEAVE_SRC() ); return $octets; } *str2bytes = \&encode; @@ -160,7 +160,7 @@ sub decode($$;$) { Carp::croak("Unknown encoding '$name'"); } my $string = $enc->decode( $octets, $check ); - $_[1] = $octets if $check and !( $check & LEAVE_SRC() ); + $_[1] = $octets if $check and !ref $check and !( $check & LEAVE_SRC() ); return $string; } *bytes2str = \&decode; @@ -499,6 +499,20 @@ but only #2 turns UTF8 flag on. #1 is equivalent to See L below. +Also note that + + from_to($octets, $from, $to, $check); + +is equivalent to + + $octets = encode($to, decode($from, $octets), $check); + +Yes, it does not respect the $check during decoding. It is +deliberately done that way. If you need minute control, C +then C as follows; + + $octets = encode($to, decode($from, $octets, $check_from), $check_to); + =item $octets = encode_utf8($string); Equivalent to C<$octets = encode("utf8", $string);> The characters diff --git a/ext/Encode/Encode.xs b/ext/Encode/Encode.xs index 9de0a64..c86ce82 100644 --- a/ext/Encode/Encode.xs +++ b/ext/Encode/Encode.xs @@ -1,5 +1,5 @@ /* - $Id: Encode.xs,v 2.12 2007/05/12 06:42:19 dankogai Exp dankogai $ + $Id: Encode.xs,v 2.13 2007/05/29 07:35:27 dankogai Exp dankogai $ */ #define PERL_NO_GET_CONTEXT @@ -70,7 +70,7 @@ do_fallback_cb(pTHX_ UV ch) { dSP; int argc; - SV* retval; + SV *temp, *retval; ENTER; SAVETMPS; PUSHMARK(sp); @@ -81,10 +81,12 @@ do_fallback_cb(pTHX_ UV ch) if (argc != 1){ croak("fallback sub must return scalar!"); } - retval = newSVsv(POPs); + temp = newSVsv(POPs); PUTBACK; FREETMPS; LEAVE; + retval = newSVpv("",0); + sv_catsv(retval, temp); return retval; } diff --git a/ext/Encode/t/fallback.t b/ext/Encode/t/fallback.t index 4cbfe77..f6fcc5a 100644 --- a/ext/Encode/t/fallback.t +++ b/ext/Encode/t/fallback.t @@ -17,7 +17,7 @@ BEGIN { use strict; #use Test::More qw(no_plan); -use Test::More tests => 44; +use Test::More tests => 48; use Encode q(:all); my $uo = ''; @@ -163,3 +163,15 @@ $src = $ao; $dst = $ascii->decode($src, sub{ sprintf "[%02X]", shift }); is($dst, $uc, "coderef decode"); is($src, $ao, "coderef residue decode"); + +$src = "\x{3000}"; +$dst = $ascii->encode($src, sub{ $_[0] }); +is $dst, 0x3000."", qq{$ascii->encode(\$src, sub{ \$_[0] } )}; +$dst = encode("ascii", "\x{3000}", sub{ $_[0] }); +is $dst, 0x3000."", qq{encode("ascii", "\\x{3000}", sub{ \$_[0] })}; + +$src = pack "C*", 0xFF; +$dst = $ascii->decode($src, sub{ $_[0] }); +is $dst, 0xFF."", qq{$ascii->encode(\$src, sub{ \$_[0] } )}; +$dst = decode("ascii", (pack "C*", 0xFF), sub{ $_[0] }); +is $dst, 0xFF."", qq{decode("ascii", (pack "C*", 0xFF), sub{ \$_[0] })}; diff --git a/ext/Encode/t/mime-name.t b/ext/Encode/t/mime-name.t index 5346497..02ff490 100644 --- a/ext/Encode/t/mime-name.t +++ b/ext/Encode/t/mime-name.t @@ -1,5 +1,5 @@ # -# $Id: mime-name.t,v 1.1 2007/05/12 06:42:19 dankogai Exp dankogai $ +# $Id: mime-name.t,v 1.1 2007/05/12 06:42:19 dankogai Exp $ # This script is written in utf8 # BEGIN {