[mutter/gnome-3-28] xprops: Make sure text_property_to_utf8() returns UTF8
- From: Marco Trevisan <marcotrevi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gnome-3-28] xprops: Make sure text_property_to_utf8() returns UTF8
- Date: Wed, 23 Jan 2019 23:59:51 +0000 (UTC)
commit fe4c3aa6b5428acdd903017d6ad19f7aeadb964b
Author: Florian Müllner <fmuellner gnome org>
Date: Mon Oct 8 22:29:01 2018 +0000
xprops: Make sure text_property_to_utf8() returns UTF8
Commit 840378ae682 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/merge_requests/227
(cherry picked from commit 76abe87090830b27e2c624b9854ca94829b04a75)
src/x11/xprops.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/x11/xprops.c b/src/x11/xprops.c
index cffa5958a..ca686b2fa 100644
--- a/src/x11/xprops.c
+++ b/src/x11/xprops.c
@@ -637,6 +637,7 @@ text_property_to_utf8 (Display *xdisplay,
{
char *ret = NULL;
char **local_list = NULL;
+ const char *charset = NULL;
int count = 0;
int res;
@@ -647,7 +648,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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]