Skip to content

Commit 63e2267

Browse files
committed
Fix locale handling in Solaris
Solaris setlocale(3C) returns composite locale prefixed by slash. For example "/en_US.UTF-8/C/C/C/C/C". See man page. We must remove it or this function will think that there is additional empty locale at the beginning of the string and the number of detected locales will not match expected LC_ALL_INDEX_.
1 parent 7946d6a commit 63e2267

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

locale.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,6 +1313,16 @@ S_parse_LC_ALL_string(pTHX_ const char * string,
13131313

13141314
Size_t index; /* Our internal index for the current category */
13151315
const char * s = string;
1316+
1317+
/* Solaris setlocale(3C) returns composite locale prefixed by slash. For example
1318+
* "/en_US.UTF-8/C/C/C/C/C". See man page. We must remove it or this
1319+
* function will think that there is additional empty locale at the
1320+
* beginning of the string and the number of detected locales will not
1321+
* match expected LC_ALL_INDEX_. */
1322+
if (s == instr(s, separator)) {
1323+
s += separator_len;
1324+
}
1325+
13161326
const char * e = s + strlen(string);
13171327
const char * category_end = NULL;
13181328
const char * saved_first = NULL;

0 commit comments

Comments
 (0)