# 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})
#
-# $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);
/*
- $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
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;
$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;
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}){
+# $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";
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;
}
+# $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";
binmode(F, ":utf8");
my $c = <F>;
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++;
}