Skip to content

Commit

Permalink
Add setlocale() call (fix #1740)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicowilliams committed Sep 6, 2023
1 parent df95871 commit 7aae55b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ AC_CHECK_MEMBER([struct tm.tm_gmtoff], [AC_DEFINE([HAVE_TM_TM_GMT_OFF],1,[Define
[], [[#include <time.h>]])
AC_CHECK_MEMBER([struct tm.__tm_gmtoff], [AC_DEFINE([HAVE_TM___TM_GMT_OFF],1,[Define to 1 if the system has the __tm_gmt_off field in struct tm])],
[], [[#include <time.h>]])
AC_FIND_FUNC([setlocale], [c], [#include <locale.h>], [0,0])

dnl Figure out if we have the pthread functions we actually need
AC_FIND_FUNC_NO_LIBS([pthread_key_create], [], [#include <pthread.h>], [NULL, NULL])
Expand Down
7 changes: 7 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
#include <ctype.h>
#include <errno.h>
#include <libgen.h>
#ifdef HAVE_SETLOCALE
#include <locale.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
Expand Down Expand Up @@ -319,6 +322,10 @@ int main(int argc, char* argv[]) {
jv ARGS = jv_array(); /* positional arguments */
jv program_arguments = jv_object(); /* named arguments */

#ifdef HAVE_SETLOCALE
(void) setlocale(LC_ALL, "");
#endif

#ifdef WIN32
jv_tsd_dtoa_ctx_init();
fflush(stdout);
Expand Down

0 comments on commit 7aae55b

Please sign in to comment.