if ($Is_EBCDIC || $Is_UTF8) { exit; }
my %templates = (
- utf8 => 'C0U',
- utf16be => 'n',
- utf16le => 'v',
+ 'UTF-8' => 'C0U',
+ 'UTF-16BE' => 'n',
+ 'UTF-16LE' => 'v',
);
sub bytes_to_utf {
foreach (sort keys %templates) {
$i++; do_require(bytes_to_utf($_, qq(print "ok $i # $_\\n"; 1;\n), 1));
+ if ($@ =~ /^(Unsupported script encoding \Q$_\E)/) {
+ print "ok $i # skip $1\n";
+ }
}
END {
my $test = 0;
my %templates = (
- utf8 => 'C0U',
- utf16be => 'n',
- utf16le => 'v',
+ 'UTF-8' => 'C0U',
+ 'UTF-16BE' => 'n',
+ 'UTF-16LE' => 'v',
);
sub bytes_to_utf {
my $template = $templates{$enc};
die "Unsupported encoding $enc" unless $template;
my @chars = unpack "U*", $content;
- if ($enc ne 'utf8') {
+ if ($enc ne 'UTF-8') {
# Make surrogate pairs
my @remember_that_utf_16_is_variable_length;
foreach my $ord (@chars) {
my $got = do "./utf$$.pl";
$test = $test + 1;
if (!defined $got) {
- print "not ok $test # $enc $bom $nl $name; got undef\n";
+ if ($@ =~ /^(Unsupported script encoding \Q$enc\E)/) {
+ print "ok $test # skip $1\n";
+ } else {
+ print "not ok $test # $enc $bom $nl $name; got undef\n";
+ }
} elsif ($got ne $expect) {
print "not ok $test # $enc $bom $nl $name; got '$got'\n";
} else {
}
for my $bom (0, 1) {
- for my $enc (qw(utf16le utf16be utf8)) {
+ for my $enc (qw(UTF-16LE UTF-16BE UTF-8)) {
for my $nl (1, 0) {
for my $value (123, 1234, 12345) {
test($enc, $value, $value, $bom, $nl, $value);
# loop without the bug fix it corresponds to:
test($enc, "($value)", $value, $bom, $nl, "($value)");
}
- next if $enc eq 'utf8';
+ next if $enc eq 'UTF-8';
# Arguably a bug that currently string literals from UTF-8 file
# handles are not implicitly "use utf8", but don't FIXME that
# right now, as here we're testing the input filter itself.
Unknown Unicode option letter '%c'
unrecognised control character '%c'
Unstable directory path, current directory changed unexpectedly
-Unsupported script encoding UTF16-BE
-Unsupported script encoding UTF16-LE
-Unsupported script encoding UTF32-BE
-Unsupported script encoding UTF32-LE
+Unsupported script encoding UTF-16BE
+Unsupported script encoding UTF-16LE
+Unsupported script encoding UTF-32BE
+Unsupported script encoding UTF-32LE
Unterminated compressed integer in unpack
Usage: CODE(0x%x)(%s)
Usage: %s(%s)
switch (s[0]) {
case 0xFF:
if (s[1] == 0xFE) {
- /* UTF-16 little-endian? (or UTF32-LE?) */
+ /* UTF-16 little-endian? (or UTF-32LE?) */
if (s[2] == 0 && s[3] == 0) /* UTF-32 little-endian */
- Perl_croak(aTHX_ "Unsupported script encoding UTF32-LE");
+ Perl_croak(aTHX_ "Unsupported script encoding UTF-32LE");
#ifndef PERL_NO_UTF16_FILTER
- if (DEBUG_p_TEST || DEBUG_T_TEST) PerlIO_printf(Perl_debug_log, "UTF16-LE script encoding (BOM)\n");
+ if (DEBUG_p_TEST || DEBUG_T_TEST) PerlIO_printf(Perl_debug_log, "UTF-16LE script encoding (BOM)\n");
s += 2;
if (PL_bufend > (char*)s) {
s = add_utf16_textfilter(s, TRUE);
}
#else
- Perl_croak(aTHX_ "Unsupported script encoding UTF16-LE");
+ Perl_croak(aTHX_ "Unsupported script encoding UTF-16LE");
#endif
}
break;
s = add_utf16_textfilter(s, FALSE);
}
#else
- Perl_croak(aTHX_ "Unsupported script encoding UTF16-BE");
+ Perl_croak(aTHX_ "Unsupported script encoding UTF-16BE");
#endif
}
break;
if (s[1] == 0) {
if (s[2] == 0xFE && s[3] == 0xFF) {
/* UTF-32 big-endian */
- Perl_croak(aTHX_ "Unsupported script encoding UTF32-BE");
+ Perl_croak(aTHX_ "Unsupported script encoding UTF-32BE");
}
}
else if (s[2] == 0 && s[3] != 0) {
/* Leading bytes
* 00 xx 00 xx
* are a good indicator of UTF-16BE. */
+#ifndef PERL_NO_UTF16_FILTER
if (DEBUG_p_TEST || DEBUG_T_TEST) PerlIO_printf(Perl_debug_log, "UTF-16BE script encoding (no BOM)\n");
- s = add_utf16_textfilter(s, FALSE);
+ s = add_utf16_textfilter(s, FALSE);
+#else
+ Perl_croak(aTHX_ "Unsupported script encoding UTF-16BE");
+#endif
}
}
#ifdef EBCDIC
/* Leading bytes
* xx 00 xx 00
* are a good indicator of UTF-16LE. */
+#ifndef PERL_NO_UTF16_FILTER
if (DEBUG_p_TEST || DEBUG_T_TEST) PerlIO_printf(Perl_debug_log, "UTF-16LE script encoding (no BOM)\n");
s = add_utf16_textfilter(s, TRUE);
+#else
+ Perl_croak(aTHX_ "Unsupported script encoding UTF-16LE");
+#endif
}
}
return (char*)s;