#
-# $Id: Unicode.t,v 1.9 2002/05/06 10:26:48 dankogai Exp $
+# $Id: Unicode.t,v 2.0 2004/05/16 20:55:17 dankogai Exp $
#
# This script is written entirely in ASCII, even though quoted literals
# do include non-BMP unicode characters -- Are you happy, jhi?
#
-our $ON_EBCDIC;
BEGIN {
require Config; import Config;
if ($Config{'extensions'} !~ /\bEncode\b/) {
print "1..0 # Skip: Encode was not built\n";
exit 0;
}
- $ON_EBCDIC = (ord("A") == 193) || $ARGV[0];
+ if (ord("A") == 193) {
+ print "1..0 # Skip: EBCDIC\n";
+ exit 0;
+ }
$| = 1;
}
# SvGROW test for (en|de)code_xs
#
SKIP: {
- skip "Not on EBCDIC", 8 if $ON_EBCDIC;
my $utf8 = '';
for my $j (0,0x10){
for my $i (0..0xffff){
closedir $dh;
for my $file (@file){
my $path = File::Spec->catfile($dir, $file);
- open my $fh, '<:utf8', $path or die "$path:$!";
- my $content = join('' => <$fh>);
+ open my $fh, '<', $path or die "$path:$!";
+ my $content;
+ if (PerlIO::Layer->find('perlio')){
+ binmode $fh => ':utf8';
+ $content = join('' => <$fh>);
+ }else{ # ugh!
+ binmode $fh;
+ $content = join('' => <$fh>);
+ Encode::_utf8_on($content)
+ }
close $fh;
is(decode("UTF-7", encode("UTF-7", $content)), $content,
"UTF-7 RT:$file");