From d387aa428a18393938c6d6f7baef2c1dd726436e Mon Sep 17 00:00:00 2001 From: Akira Nakajima Date: Thu, 11 Oct 2018 07:15:22 +0000 Subject: [PATCH] Characters of window title bar garbled --- src/x11/window-props.c | 5 +---- src/x11/xprops.c | 6 +++++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/x11/window-props.c b/src/x11/window-props.c index d06a89a21..d165c2cd2 100644 --- a/src/x11/window-props.c +++ b/src/x11/window-props.c @@ -651,10 +651,7 @@ reload_wm_name (MetaWindow *window, if (value->type != META_PROP_VALUE_INVALID) { - g_autofree gchar *title = g_convert (value->v.str, -1, - "UTF-8", "LATIN1", - NULL, NULL, NULL); - set_window_title (window, title); + set_window_title (window, value->v.str); meta_verbose ("Using WM_NAME for new title of %s: \"%s\"\n", window->desc, window->title); diff --git a/src/x11/xprops.c b/src/x11/xprops.c index ae05afe14..2bef29985 100644 --- a/src/x11/xprops.c +++ b/src/x11/xprops.c @@ -639,6 +639,7 @@ text_property_to_utf8 (Display *xdisplay, { char *ret = NULL; char **local_list = NULL; + const char *charset = NULL; int count = 0; int res; @@ -649,7 +650,10 @@ text_property_to_utf8 (Display *xdisplay, if (count == 0) goto out; - ret = g_strdup (local_list[0]); + if (g_get_charset (&charset)) + ret = g_strdup (local_list[0]); + else + ret = g_convert (local_list[0], -1, "UTF-8", charset, NULL, NULL, NULL); out: XFreeStringList (local_list);