Subject: Bug#1305: bad window title encoding for Unicode (Cyrillic) session names

From: Ivan Zakharyaschev <[email-masked]>
Date: Fri, 15 Jun 2018 22:21:35 +0300 (MSK)

Package: x2goclient
Version: 4.1.1.1
Tag: patch

If the session name is written in Cyrillic (I guess, any Unicode), the 
window title is displayed incorrectly (as if Unicode was not understood, 
with strange symbols) in the task bar in the KDE panel.

See the attached screenshot (made by mcpain@).

Patch (by mcpain@ and zerg@) is attached, too: 
x2goclient-4.1.1.1-window-title-encoding.patch

The client and server OS are: ALT Linux (Sisyphus or p8).
The window manager is KDE.

From 877cc06728efac1ccd7c01d47c25df0166de42e8 Mon Sep 17 00:00:00 2001
From: Oleg Solovyov <[email-masked]>
Date: Fri, 15 Jun 2018 20:55:26 +0300
Subject: [PATCH] fix window title encoding for Unicode (Cyrillic) session
 names

If the session name was written in Cyrillic, the window title would be
displayed incorrectly (as if Unicode was not understood, with strange
symbols) in the task bar in the KDE panel.

Co-authored-by: Sergey V Turchin <[email-masked]>
---
 src/onmainwindow.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp
index fdc043b..7b2c283 100644
--- a/src/onmainwindow.cpp
+++ b/src/onmainwindow.cpp
@@ -11233,6 +11233,12 @@ void ONMainWindow::setProxyWinTitle()
 #ifdef Q_OS_LINUX
 
     XStoreName(QX11Info::display(), proxyWinId, title.toLocal8Bit().data());
+    XChangeProperty(QX11Info::display(), proxyWinId,
+                    XInternAtom(QX11Info::display(), "_NET_WM_NAME", 0),
+                    XInternAtom(QX11Info::display(), "UTF8_STRING", 0), 8,
+                    PropModeReplace,
+                    (unsigned char*) title.toUtf8().data(),
+                    strlen(title.toUtf8().data()));
 
     XWMHints* win_hints;
 
-- 
2.10.4