From: Jarkko Hietaniemi <jhi@iki.fi>
Date: Thu, 10 Apr 2003 04:18:45 +0000 (+0000)
Subject: Also locale names can contain illegal UTF-8.
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5fef21a34e2a36dc7c83d55110ccc5c57cc7d14d;p=p5sagit%2Fp5-mst-13.2.git

Also locale names can contain illegal UTF-8.

p4raw-id: //depot/perl@19176
---

diff --git a/lib/locale.t b/lib/locale.t
index 7b27330..2143b9f 100644
--- a/lib/locale.t
+++ b/lib/locale.t
@@ -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 {