[aisleriot] sol: Don't accept non-UTF-8 locale



commit e2d3fa5d6ed9f8c0a4af9214e526f75622d5e641
Author: Christian Persch <chpe gnome org>
Date:   Sat Mar 19 13:24:47 2016 +0100

    sol: Don't accept non-UTF-8 locale
    
    This leads to strings in guile being replaced by '?'s when
    mixed with UTF-8 strings.

 src/lib/ar-runtime.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/src/lib/ar-runtime.c b/src/lib/ar-runtime.c
index deb6edc..4242513 100644
--- a/src/lib/ar-runtime.c
+++ b/src/lib/ar-runtime.c
@@ -256,9 +256,15 @@ gboolean
 ar_runtime_init (const char *name)
 {
   gboolean retval;
+  const char *charset;
 
   setlocale (LC_ALL, "");
 
+  if (!g_get_charset (&charset)) {
+    g_printerr ("Non UTF-8 locale (%s) is not supported!\n", charset);
+    return FALSE;
+  }
+
 #ifdef G_OS_WIN32
   /* On Windows, when called from a console, get console output. This works
    * only with Windows XP or higher; Windows 2000 will not have console


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