Skip to content

Commit f890224

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 f890224

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,6 +1439,7 @@ Vlad Harchev <[email protected]>
14391439
Vladimir Alexiev <[email protected]>
14401440
Vladimir Marek <[email protected]>
14411441
Vladimir Timofeev <[email protected]>
1442+
Vladimír Marek <[email protected]>
14421443
Volker Schatz <[email protected]>
14431444
14441445
W. Geoffrey Rommel <[email protected]>

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 (strnEQ(s, separator, separator_len)) {
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)