From: Jarkko Hietaniemi Date: Wed, 22 Jan 2003 13:19:31 +0000 (+0000) Subject: Upgrade to Encode 1.86. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fa6f41cfedcd9c19e472d10292b6d4367aa3b9b0;p=p5sagit%2Fp5-mst-13.2.git Upgrade to Encode 1.86. p4raw-id: //depot/perl@18559 --- diff --git a/ext/Encode/Changes b/ext/Encode/Changes index cc1615a..6872c60 100644 --- a/ext/Encode/Changes +++ b/ext/Encode/Changes @@ -1,9 +1,25 @@ # Revision history for Perl extension Encode. # -# $Id: Changes,v 1.84 2003/01/10 12:00:16 dankogai Exp dankogai $ +# $Id: Changes,v 1.86 2003/01/22 03:29:07 dankogai Exp $ # -$Revision: 1.84 $ $Date: 2003/01/10 12:00:16 $ +$Revision: 1.86 $ $Date: 2003/01/22 03:29:07 $ +! encoding.pm + * Don't forget to canonize when you attempt an exact match! + Message-Id: <73E7F801-2DAA-11D7-BF9A-000393AE4244@dan.co.jp> + * ${^ENCODING} exception is off for $] > 5.008 + Message-Id: <20030122110617T.inaba.hiroto@toshiba-it.co.jp> +! t/enc_utf8.t + $] check commented out so it runs on 5.8.0 + +1.85 2003/01/21 22:19:14 +! encoding.pm + ${^ENCODING} exception is now explicit rather than handled by regex. ++ t/enc_eucjp.t t/enc_utf8.t + Test suite for the better "encoding" pragma support for bleedperl. + On 5.8.0, they will just be skipped. + +1.84 2003/01/10 12:00:16 ! encoding.pm ${^ENCODING} is no longer set for utf so encoding is no longer fun :) (That is to prevent duplicate encoding first by IO then ${^ENCODING}) diff --git a/ext/Encode/Encode.pm b/ext/Encode/Encode.pm index 4bf30e1..c85cbbe 100644 --- a/ext/Encode/Encode.pm +++ b/ext/Encode/Encode.pm @@ -1,9 +1,9 @@ # -# $Id: Encode.pm,v 1.84 2003/01/10 12:00:16 dankogai Exp dankogai $ +# $Id: Encode.pm,v 1.86 2003/01/22 03:30:40 dankogai Exp $ # package Encode; use strict; -our $VERSION = do { my @r = (q$Revision: 1.84 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; +our $VERSION = do { my @r = (q$Revision: 1.86 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; our $DEBUG = 0; use XSLoader (); XSLoader::load(__PACKAGE__, $VERSION); diff --git a/ext/Encode/Unicode/Unicode.xs b/ext/Encode/Unicode/Unicode.xs index fb5c61b..52484dd 100644 --- a/ext/Encode/Unicode/Unicode.xs +++ b/ext/Encode/Unicode/Unicode.xs @@ -1,5 +1,5 @@ /* - $Id: Unicode.xs,v 1.6 2003/01/10 12:00:16 dankogai Exp dankogai $ + $Id: Unicode.xs,v 1.6 2003/01/10 12:00:16 dankogai Exp $ */ #define PERL_NO_GET_CONTEXT diff --git a/ext/Encode/encoding.pm b/ext/Encode/encoding.pm index 1a43790..1681034 100644 --- a/ext/Encode/encoding.pm +++ b/ext/Encode/encoding.pm @@ -1,5 +1,5 @@ package encoding; -our $VERSION = do { my @r = (q$Revision: 1.38 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; +our $VERSION = do { my @r = (q$Revision: 1.40 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; use Encode; use strict; @@ -17,6 +17,9 @@ unless ($@){ $HAS_PERLIO = (PerlIO::encoding->VERSION >= 0.02); } +my %utfs = map {$_=>1} + qw(utf8 UCS-2BE UCS-2LE UTF-16 UTF-16BE UTF-16LE UTF-32 UTF-32BE UTF-32LE); + sub import { my $class = shift; my $name = shift; @@ -28,8 +31,9 @@ sub import { require Carp; Carp::croak("Unknown encoding '$name'"); } + $name = $enc->name; # canonize unless ($arg{Filter}) { - ${^ENCODING} = $enc; + ${^ENCODING} = $enc unless $] <= 5.008 and $utfs{$name}; $HAS_PERLIO or return 1; for my $h (qw(STDIN STDOUT)){ if ($arg{$h}){ diff --git a/ext/Encode/t/enc_eucjp.t b/ext/Encode/t/enc_eucjp.t index 019b426..8bc1f4d 100644 --- a/ext/Encode/t/enc_eucjp.t +++ b/ext/Encode/t/enc_eucjp.t @@ -1,7 +1,12 @@ +# $Id: enc_eucjp.t,v 1.1 2003/01/21 22:19:14 dankogai Exp $ # This is the twin of enc_utf8.t, the only difference is that # this has "use encoding 'euc-jp'". BEGIN { + if ($] <= 5.008){ + print "1..0 # Skip: Perl 5.8.1 or later required\n"; + exit 0; + } require Config; import Config; if ($Config{'extensions'} !~ /\bEncode\b/) { print "1..0 # Skip: Encode was not built\n"; @@ -30,6 +35,7 @@ for my $i (0..$#c) { open(F, ">f$i") or die "$0: failed to open 'f$i' for writing: $!"; binmode(F, ":utf8"); print F chr($c[$i]); + print F pack("C" => $c[$i]); close F; } diff --git a/ext/Encode/t/enc_utf8.t b/ext/Encode/t/enc_utf8.t index 6271fe6..cce63e3 100644 --- a/ext/Encode/t/enc_utf8.t +++ b/ext/Encode/t/enc_utf8.t @@ -1,7 +1,12 @@ +# $Id: enc_utf8.t,v 1.2 2003/01/22 03:29:07 dankogai Exp $ # This is the twin of enc_eucjp.t, the only difference is that # this has "use encoding 'utf8'". BEGIN { +# if ($] <= 5.008){ +# print "1..0 # Skip: Perl 5.8.1 or later required\n"; +# exit 0; +# } require Config; import Config; if ($Config{'extensions'} !~ /\bEncode\b/) { print "1..0 # Skip: Encode was not built\n"; @@ -40,7 +45,7 @@ for my $i (0..$#c) { binmode(F, ":utf8"); my $c = ; my $o = ord($c); - print $o == $c[$i] ? "ok $t - utf8 I/O $c[$i]\n" : "not ok $t - utf8 I/O $c[$$i]: $o != $c[$i]\n"; + print $o == $c[$i] ? "ok $t - utf8 I/O $c[$i]\n" : "not ok $t - utf8 I/O $c[$i]: $o != $c[$i]\n"; $t++; }