Change 31305 by [EMAIL PROTECTED] on 2007/05/29 09:33:52
Upgrade to Encode 2.22
Affected files ...
... //depot/perl/ext/Encode/Changes#83 edit
... //depot/perl/ext/Encode/Encode.pm#170 edit
... //depot/perl/ext/Encode/Encode.xs#128 edit
... //depot/perl/ext/Encode/t/fallback.t#10 edit
... //depot/perl/ext/Encode/t/mime-name.t#2 edit
Differences ...
==== //depot/perl/ext/Encode/Changes#83 (text) ====
Index: perl/ext/Encode/Changes
--- perl/ext/Encode/Changes#82~31061~ 2007-04-24 18:06:23.000000000 -0700
+++ perl/ext/Encode/Changes 2007-05-29 02:33:52.000000000 -0700
@@ -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 <[EMAIL PROTECTED]>
+ Date: Thu, 12 Apr 2007 08:41:53 +0200
+ Message-ID: <[EMAIL PROTECTED]>
+ http://public.activestate.com/cgi-bin/perlbrowse/p/31194
+! Unicode/Unicode.pm
+ POD fix.
+ Message-Id: <[EMAIL PROTECTED]>
+
+2.20 2007/04/22 14:56:12
! Encode.pm
Pod fixes. Now find_encoding() is explained more in details.
+ lib/Encode/GSM0338.pm
==== //depot/perl/ext/Encode/Encode.pm#170 (text) ====
Index: perl/ext/Encode/Encode.pm
--- perl/ext/Encode/Encode.pm#169~31212~ 2007-05-13 09:47:40.000000000
-0700
+++ perl/ext/Encode/Encode.pm 2007-05-29 02:33:52.000000000 -0700
@@ -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 @@
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 @@
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 @@
See L</"The UTF8 flag"> 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<decode>
+then C<encode> 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
==== //depot/perl/ext/Encode/Encode.xs#128 (text) ====
Index: perl/ext/Encode/Encode.xs
--- perl/ext/Encode/Encode.xs#127~31212~ 2007-05-13 09:47:40.000000000
-0700
+++ perl/ext/Encode/Encode.xs 2007-05-29 02:33:52.000000000 -0700
@@ -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 @@
{
dSP;
int argc;
- SV* retval;
+ SV *temp, *retval;
ENTER;
SAVETMPS;
PUSHMARK(sp);
@@ -81,10 +81,12 @@
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;
}
==== //depot/perl/ext/Encode/t/fallback.t#10 (text) ====
Index: perl/ext/Encode/t/fallback.t
--- perl/ext/Encode/t/fallback.t#9~28098~ 2006-05-04 05:06:33.000000000
-0700
+++ perl/ext/Encode/t/fallback.t 2007-05-29 02:33:52.000000000 -0700
@@ -17,7 +17,7 @@
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 @@
$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] })};
==== //depot/perl/ext/Encode/t/mime-name.t#2 (text) ====
Index: perl/ext/Encode/t/mime-name.t
--- perl/ext/Encode/t/mime-name.t#1~31212~ 2007-05-13 09:47:40.000000000
-0700
+++ perl/ext/Encode/t/mime-name.t 2007-05-29 02:33:52.000000000 -0700
@@ -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 {
End of Patch.