Skip to content
Permalink
Browse files

reset LC_NUMERIC locale setting to C based on Perl bug reported in ht…

  • Loading branch information...
karpet committed Aug 21, 2014
1 parent 2f53150 commit 483c1d5bfbefd15c39f3a08992cd2936121189ec
Showing with 9 additions and 2 deletions.
  1. +9 −2 src/libswish3/string.c
@@ -280,13 +280,16 @@ swish_get_locale(
{
char *locale;

/* initialize with LC_ALL sets all the relevant env vars */
/* initialize locale using environment variables --
* see locale(7) and setlocale(3) man pages.
*/
setlocale(LC_ALL, "");
/* fetch the current locale so we can test it */
locale = setlocale(LC_ALL, "");
if (locale == NULL || !strlen(locale)) {
//SWISH_DEBUG_MSG("locale for LC_ALL was null");

/* use LC_CTYPE specifically:
/* check LC_CTYPE specifically:
* http://mail.nl.linux.org/linux-utf8/2001-09/msg00030.html
*/
locale = setlocale(LC_CTYPE, "");
@@ -299,6 +302,10 @@ swish_get_locale(
}
}
}
/* Must re-set LC_NUMERIC to portable C
* This is due to behavior of Perl > v5.18
*/
setlocale(LC_NUMERIC, "C");
return locale;
}

0 comments on commit 483c1d5

Please sign in to comment.
You can’t perform that action at this time.