summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Müllner <fmuellner@gnome.org>2018-10-09 00:29:01 +0200
committerAlberts Muktupāvels <alberts.muktupavels@gmail.com>2018-11-19 18:04:05 +0200
commit206ef11aa9d09c91437bdef86364c1e5edadf244 (patch)
tree45d9efe6d1c397c8678579b68c1fcd27fcd13291
parent92f4cd4e9d939350caa2a60b55b8d36d7c86ea9d (diff)
downloadmetacity-206ef11aa9d09c91437bdef86364c1e5edadf244.tar.gz
xprops: make sure text_property_to_utf8() returns UTF8
Commit fd65a64082f8 changed the code to use XmbTextPropertyToTextList() instead of gdk_text_property_to_utf8_list_for_display(), but didn't take into account that the replacement returns text in the current locale's encoding, while any callers (rightfully) expect UTF8. Fix this by converting the text if necessary. https://gitlab.gnome.org/GNOME/mutter/commit/76abe87090830b27e2c6
-rw-r--r--src/core/xprops.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/core/xprops.c b/src/core/xprops.c
index 0cadb462..a1cd901f 100644
--- a/src/core/xprops.c
+++ b/src/core/xprops.c
@@ -668,6 +668,7 @@ text_property_to_utf8 (Display *xdisplay,
{
char *ret = NULL;
char **local_list = NULL;
+ const char *charset = NULL;
int count = 0;
int res;
@@ -678,7 +679,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:
meta_XFree (local_list);