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)
+ if (! is_invariant_string((U8 *) lc->decimal_point, 0)
&& is_utf8_string((U8 *) lc->decimal_point, 0)
&& _is_cur_LC_category_utf8(LC_NUMERIC))
{
#ifdef MB_CUR_MAX
/* We only handle single-byte locales (outside of UTF-8 ones; so if
- * this locale has requires than one byte, there are going to be
- * problems */
+ * this locale requires than one byte, there are going to be
+ * problems. */
if (check_for_problems && MB_CUR_MAX > 1) {
multi_byte_locale = TRUE;
}
#endif
if (bad_count || multi_byte_locale) {
+
+ /* We have to save 'newctype' because the setlocale() just below
+ * may destroy it. The next setlocale() further down should
+ * restore it properly so that the intermediate change here is
+ * transparent to this function's caller */
+ const char * const badlocale = savepv(newctype);
+
setlocale(LC_CTYPE, "C");
Perl_warner(aTHX_ packWARN(WARN_LOCALE),
"Locale '%s' may not work well.%s%s%s\n",
- newctype,
+ badlocale,
(multi_byte_locale)
? " Some characters in it are not recognized by"
" Perl."
? bad_chars_list
: ""
);
- setlocale(LC_CTYPE, newctype);
+ setlocale(LC_CTYPE, badlocale);
}
}
lc = localeconv();
if (! lc
|| ! lc->currency_symbol
- || is_ascii_string((U8 *) lc->currency_symbol, 0))
+ || is_invariant_string((U8 *) lc->currency_symbol, 0))
{
DEBUG_L(PerlIO_printf(Perl_debug_log, "Couldn't get currency symbol for %s, or contains only ASCII; can't use for determining if UTF-8 locale\n", save_input_locale));
only_ascii = TRUE;
/* Here the current LC_TIME is set to the locale of the category
* whose information is desired. Look at all the days of the week and
- * month names, and the timezone and am/pm indicator for non-ASCII
+ * month names, and the timezone and am/pm indicator for UTF-8 variant
* characters. The first such a one found will tell us if the locale
* is UTF-8 or not */
for (i = 0; i < 7 + 12; i++) { /* 7 days; 12 months */
formatted_time = my_strftime("%A %B %Z %p",
0, 0, hour, dom, month, 112, 0, 0, is_dst);
- if (! formatted_time || is_ascii_string((U8 *) formatted_time, 0)) {
+ if (! formatted_time || is_invariant_string((U8 *) formatted_time, 0)) {
/* Here, we didn't find a non-ASCII. Try the next time through
* with the complemented dst and am/pm, and try with the next
break;
}
errmsg = savepv(errmsg);
- if (! is_ascii_string((U8 *) errmsg, 0)) {
+ if (! is_invariant_string((U8 *) errmsg, 0)) {
non_ascii = TRUE;
is_utf8 = is_utf8_string((U8 *) errmsg, 0);
break;