Also locale names can contain illegal UTF-8.
authorJarkko Hietaniemi <jhi@iki.fi>
Thu, 10 Apr 2003 04:18:45 +0000 (04:18 +0000)
committerJarkko Hietaniemi <jhi@iki.fi>
Thu, 10 Apr 2003 04:18:45 +0000 (04:18 +0000)
p4raw-id: //depot/perl@19176

lib/locale.t

index 7b27330..2143b9f 100644 (file)
@@ -523,7 +523,17 @@ foreach $Locale (@Locale) {
     
        my $word = join('', @Neoalpha);
 
-       if ($Locale =~ /utf-?8/i) {
+       my $badutf8;
+       {
+           local $SIG{__WARN__} = sub {
+               $badutf8 = $_[0] =~ /Malformed UTF-8/;
+           };
+           $Locale =~ /utf-?8/i;
+       }
+
+       if ($badutf8) {
+           debug "# Locale name contains bad UTF-8, skipping test 99 for locale '$Locale'\n";
+       } elsif ($Locale =~ /utf-?8/i) {
            debug "# unknown whether locale and Unicode have the same \\w, skipping test 99 for locale '$Locale'\n";
            push @{$Okay{99}}, $Locale;
        } else {