[pango/wip/lantw/pango-list-call-setlocale-in-main-function] pango-list: Call setlocale in main function



commit 0956ddc863111e46600fc0b1766bb6b7067d25b7
Author: Ting-Wei Lan <lantw src gnome org>
Date:   Mon Jul 29 18:56:09 2019 +0800

    pango-list: Call setlocale in main function
    
    If it isn't called, GLib will try to convert non-ASCII characters to
    ASCII because LC_CTYPE locale is C. Therefore, all non-ASCII characters
    are displayed as question marks because the conversion always fails.

 utils/pango-list.c | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/utils/pango-list.c b/utils/pango-list.c
index f22792df..3d360975 100644
--- a/utils/pango-list.c
+++ b/utils/pango-list.c
@@ -25,6 +25,7 @@
 #include <hb-ot.h>
 #include <glib/gstdio.h>
 #include <stdlib.h>
+#include <locale.h>
 
 /* FIXME: This doesn't work if the font has an avar table */
 static float
@@ -61,6 +62,7 @@ main (int    argc,
   GError *error = NULL;
 
   g_set_prgname ("pango-list");
+  setlocale (LC_ALL, "");
 
   context = g_option_context_new ("");
   g_option_context_add_main_entries (context, entries, NULL);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]