[glib: 1/3] tests: Set locale in gtestutils tests to allow UTF-8 output



commit 81dbc7b07bf08542d170be9e7dc5277d783662aa
Author: Philip Withnall <withnall endlessm com>
Date:   Wed May 15 13:42:04 2019 +0100

    tests: Set locale in gtestutils tests to allow UTF-8 output
    
    Signed-off-by: Philip Withnall <withnall endlessm com>

 glib/tests/testing-helper.c | 3 +++
 glib/tests/testing.c        | 4 +++-
 2 files changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/glib/tests/testing-helper.c b/glib/tests/testing-helper.c
index c472778a5..bc5c873fa 100644
--- a/glib/tests/testing-helper.c
+++ b/glib/tests/testing-helper.c
@@ -17,6 +17,7 @@
  */
 
 #include <glib.h>
+#include <locale.h>
 #ifdef G_OS_WIN32
 #include <fcntl.h>
 #include <io.h>
@@ -52,6 +53,8 @@ main (int   argc,
 {
   char *argv1;
 
+  setlocale (LC_ALL, "");
+
 #ifdef G_OS_WIN32
   /* Windows opens std streams in text mode, with \r\n EOLs.
    * Sometimes it's easier to force a switch to binary mode than
diff --git a/glib/tests/testing.c b/glib/tests/testing.c
index 52895f7c1..f2f86cdb8 100644
--- a/glib/tests/testing.c
+++ b/glib/tests/testing.c
@@ -29,7 +29,7 @@
 #define G_LOG_DOMAIN "testing"
 
 #include <glib.h>
-
+#include <locale.h>
 #include <stdlib.h>
 #include <string.h>
 
@@ -1215,6 +1215,8 @@ main (int   argc,
 {
   argv0 = argv[0];
 
+  setlocale (LC_ALL, "");
+
   g_test_init (&argc, &argv, NULL);
 
   g_test_add_func ("/random-generator/rand-1", test_rand1);


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