-SKIP: {
- skip("no UTF-8 locale available where LC_NUMERIC radix isn't ASCII", 1 )
- unless $utf8_radix;
- ok($radix_encoded_as_utf8 == 1, "UTF-8 locale '$utf8_radix' with non-ASCII"
- . " radix is marked UTF-8");
-}
+ my ($base, $different, $comma, $difference, $utf8_radix);
+ my $radix_encoded_as_utf8;
+ for ("C", @locales) { # prefer C for the base if available
+ use locale;
+ setlocale(LC_NUMERIC, $_) or next;
+ my $in = 4.2; # avoid any constant folding bugs
+ if ((my $s = sprintf("%g", $in)) eq "4.2") {
+ $base ||= $_;
+ } else {
+ $different ||= $_;
+ $difference ||= $s;
+ my $radix = localeconv()->{decimal_point};
+
+ # For utf8 locales with a non-ascii radix, it should be encoded as
+ # UTF-8 with the internal flag so set.
+ if (! defined $utf8_radix
+ && $radix =~ /[[:^ascii:]]/u # /u because /l can raise warnings
+ && is_locale_utf8($_))
+ {
+ $utf8_radix = $_;
+ $radix_encoded_as_utf8 = utf8::is_utf8($radix);
+ }
+ else {
+ $comma ||= $_ if $radix eq ',';
+ }
+ }