From: Jarkko Hietaniemi Date: Mon, 28 May 2001 17:59:00 +0000 (+0000) Subject: The #10260 was too bold: locales and utf8 still do not mix. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8ac0d9e6f1afa3b40604ca5d8273529ba8933c21;p=p5sagit%2Fp5-mst-13.2.git The #10260 was too bold: locales and utf8 still do not mix. p4raw-id: //depot/perl@10264 --- diff --git a/t/pragma/locale.t b/t/pragma/locale.t index ecbd80e..000203b 100755 --- a/t/pragma/locale.t +++ b/t/pragma/locale.t @@ -424,6 +424,8 @@ if (-x "/usr/bin/locale" && open(LOCALES, "/usr/bin/locale -a 2>/dev/null|")) { setlocale(LC_ALL, "C"); +sub utf8locale { $_[0] =~ /utf-?8/i } + @Locale = sort @Locale; debug "# Locales = @Locale\n"; @@ -512,12 +514,16 @@ foreach $Locale (@Locale) { # Test \w. - my $word = join('', @Neoalpha); - - $word =~ /^(\w+)$/; - - tryneoalpha($Locale, 99, $1 eq $word); + if (utf8locale($Locale)) { + # utf8 and locales do not mix. + debug "# skipping UTF-8 locale '$Locale'\n"; + } else { + my $word = join('', @Neoalpha); + $word =~ /^(\w+)$/; + + tryneoalpha($Locale, 99, $1 eq $word); + } # Cross-check the whole 8-bit character set. for (map { chr } 0..255) { @@ -691,23 +697,29 @@ foreach $Locale (@Locale) { # case-insensitively the UPPER, and does the UPPER match # case-insensitively the lc of the UPPER. And vice versa. { - use locale; - no utf8; # so that the native 8-bit characters work - - my @f = (); - foreach my $x (keys %UPPER) { - my $y = lc $x; - next unless uc $y eq $x; - push @f, $x unless $x =~ /$y/i && $y =~ /$x/i; - } - foreach my $x (keys %lower) { - my $y = uc $x; - next unless lc $y eq $x; - push @f, $x unless $x =~ /$y/i && $y =~ /$x/i; - } - tryneoalpha($Locale, 116, @f == 0); - if (@f) { - print "# failed 116 locale '$Locale' characters @f\n" + if (utf8locale($Locale)) { + # utf8 and locales do not mix. + debug "# skipping UTF-8 locale '$Locale'\n"; + } else { + use locale; + use locale; + no utf8; # so that the native 8-bit characters work + + my @f = (); + foreach my $x (keys %UPPER) { + my $y = lc $x; + next unless uc $y eq $x; + push @f, $x unless $x =~ /$y/i && $y =~ /$x/i; + } + foreach my $x (keys %lower) { + my $y = uc $x; + next unless lc $y eq $x; + push @f, $x unless $x =~ /$y/i && $y =~ /$x/i; + } + tryneoalpha($Locale, 116, @f == 0); + if (@f) { + print "# failed 116 locale '$Locale' characters @f\n" + } } } }