my $ok12;
my $ok13;
my $ok14;
+ my $ok15;
+ my $ok16;
my $c;
my $d;
$ok11 = $f == $c;
$ok12 = abs(($f + $g) - 3.57) < 0.01;
$ok13 = $w == 0;
- $ok14 = 1; # Skip for non-utf8 locales
+ $ok14 = $ok15 = $ok16 = 1; # Skip for non-utf8 locales
}
}
else {
last;
}
}
+
+ # Similarly, we verify that a non-ASCII radix is in UTF-8. This
+ # also catches if there is a disparity between sprintf and
+ # stringification.
+
+ my $string_g = "$g";
+
+ my $utf8_string_g = "$g";
+ utf8::upgrade($utf8_string_g);
+
+ my $utf8_sprintf_g = sprintf("%g", $g);
+ utf8::upgrade($utf8_sprintf_g);
+ use bytes;
+ $ok15 = $utf8_string_g eq $string_g;
+ $ok16 = $utf8_sprintf_g eq $string_g;
}
}
tryneoalpha($Locale, ++$locales_test_number, $ok14);
$test_names{$locales_test_number} = 'Verify that non-ASCII UTF-8 error messages are in UTF-8';
+ tryneoalpha($Locale, ++$locales_test_number, $ok15);
+ $test_names{$locales_test_number} = 'Verify that a number with a UTF-8 radix has a UTF-8 stringification';
+
+ tryneoalpha($Locale, ++$locales_test_number, $ok16);
+ $test_names{$locales_test_number} = 'Verify that a sprintf of a number with a UTF-8 radix yields UTF-8';
+
debug "# $first_f_test..$locales_test_number: \$f = $f, \$g = $g, back to locale = $Locale\n";
# Does taking lc separately differ from taking
sv_setpv(PL_numeric_radix_sv, lc->decimal_point);
else
PL_numeric_radix_sv = newSVpv(lc->decimal_point, 0);
+ if (! is_ascii_string((U8 *) lc->decimal_point, 0)
+ && is_utf8_string((U8 *) lc->decimal_point, 0)
+ && is_cur_LC_category_utf8(LC_NUMERIC))
+ {
+ SvUTF8_on(PL_numeric_radix_sv);
+ }
}
}
else
* TRUE in that case), no need to do any changing */
if (PL_numeric_standard || IN_SOME_LOCALE_FORM_RUNTIME) {
Gconvert(SvNVX(sv), NV_DIG, 0, s);
+
+ /* If the radix character is UTF-8, and actually is in the
+ * output, turn on the UTF-8 flag for the scalar */
+ if (! PL_numeric_standard
+ && PL_numeric_radix_sv && SvUTF8(PL_numeric_radix_sv)
+ && instr(s, SvPVX_const(PL_numeric_radix_sv)))
+ {
+ SvUTF8_on(sv);
+ }
}
else {
char *loc = savepv(setlocale(LC_NUMERIC, NULL));
Gconvert(SvNVX(sv), NV_DIG, 0, s);
setlocale(LC_NUMERIC, loc);
Safefree(loc);
+
}
/* We don't call SvPOK_on(), because it may come to pass that the
}
float_converted:
eptr = PL_efloatbuf;
+ if (PL_numeric_radix_sv && SvUTF8(PL_numeric_radix_sv)
+ && instr(eptr, SvPVX_const(PL_numeric_radix_sv)))
+ {
+ is_utf8 = TRUE;
+ }
+
break;
/* SPECIAL */