diff --git a/locale.c b/locale.c index 17233740e0d6..80213ef5e33d 100644 --- a/locale.c +++ b/locale.c @@ -5724,6 +5724,11 @@ S_my_localeconv(pTHX_ const int item) for (unsigned int i = 0; i < 2; i++) { /* Try both types of strings */ + /* The return from this function is already adjusted */ + if (populate[i] == S_populate_hash_from_C_localeconv) { + continue; + } + /* Examine each string */ for (const lconv_offset_t *strp = strings[i]; strp->name; strp++) { const char * name = strp->name; @@ -5731,16 +5736,17 @@ S_my_localeconv(pTHX_ const int item) /* 'value' will contain the string that may need to be marked as * UTF-8 */ SV ** value = hv_fetch(hv, name, strlen(name), true); - if (! value || ! SvPOK(*value)) { + if (value == NULL) { continue; } /* Determine if the string should be marked as UTF-8. */ - if (UTF8NESS_YES == (get_locale_string_utf8ness_i(SvPVX(*value), - LOCALE_UTF8NESS_UNKNOWN, - locales[i], - LC_ALL_INDEX_ /* OOB */))) - { + if ( UTF8NESS_YES + == (get_locale_string_utf8ness_i(SvPVX(*value), + LOCALE_UTF8NESS_UNKNOWN, + locales[i], + LC_ALL_INDEX_ /* OOBounds */ + ))) { SvUTF8_on(*value); } }