From 38936b2b2af7a97d8e3c251c22aed09cd83b1981 Mon Sep 17 00:00:00 2001 From: Ting-Wei Lan Date: Sun, 23 Jun 2019 22:37:54 +0800 Subject: [PATCH] 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. --- main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.c b/main.c index 9b27d9a..cfebdba 100644 --- a/main.c +++ b/main.c @@ -28,6 +28,7 @@ #include #include #include +#include #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 */