Call setlocale in main function

If setlocale isn't called, GNU gettext will try to convert translated
text to ASCII because the default locale is C. It isn't always possible
and it causes question marks to be shown on FreeBSD.
This commit is contained in:
Ting-Wei Lan 2019-06-23 22:37:54 +08:00
parent 2ad16fa7ac
commit 38936b2b2a

6
main.c
View file

@ -28,6 +28,7 @@
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <locale.h>
#ifdef G_OS_WIN32
#define STRICT
@ -494,6 +495,11 @@ main (int argc, char **argv)
GError *error = NULL;
GOptionContext *opt_context;
setlocale (LC_CTYPE, "");
#ifdef LC_MESSAGES
setlocale (LC_MESSAGES, "");
#endif
/* This is here so that we get debug spew from the start,
* during arg parsing
*/