[gnome-desktop/gnome-3-8] xkb: Ensure strings from xkeyboard-config are UTF-8



commit 6df680a892bcbd739daf903ac1ca3dc17cf330af
Author: Christophe Fergeau <cfergeau redhat com>
Date:   Fri Jun 28 15:30:44 2013 +0200

    xkb: Ensure strings from xkeyboard-config are UTF-8
    
    When using g_dgettext, translated strings are returned in the
    current locale's encoding. This means XKEYBOARD_CONFIG() can
    give us a non-UTF-8 string if a non-UTF-8 locale is in use.
    Calling bind_textdomain_codeset() ensures that the strings returned
    by g_dgettext will be encoded in UTF-8, which is what applications
    using gnome-desktop expect.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=703247

 libgnome-desktop/gnome-xkb-info.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/libgnome-desktop/gnome-xkb-info.c b/libgnome-desktop/gnome-xkb-info.c
index 9fdf40b..eec1224 100644
--- a/libgnome-desktop/gnome-xkb-info.c
+++ b/libgnome-desktop/gnome-xkb-info.c
@@ -584,6 +584,10 @@ parse_rules (GnomeXkbInfo *self)
   gchar *file_path;
   GError *error = NULL;
 
+  /* Make sure the translated strings we get from XKEYBOARD_CONFIG() are
+   * in UTF-8 and not in the current locale */
+  bind_textdomain_codeset ("xkeyboard-config", "UTF-8");
+
   /* Maps option group ids to XkbOptionGroup structs. Owns the
      XkbOptionGroup structs. */
   priv->option_groups_table = g_hash_table_new_full (g_str_hash, g_str_equal,


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