File fix-non-utf8-title.diff of Package kdelibs3

Index: kdecore/kwin.cpp
===================================================================
--- kdecore/kwin.cpp	(revision 465272)
+++ kdecore/kwin.cpp	(revision 521001)
@@ -64,6 +64,8 @@ static Atom net_wm_context_help;
 static Atom kde_wm_change_state;
 static Atom kde_wm_window_opacity;
 static Atom kde_wm_window_shadow;
+static Atom kwin_UTF8_STRING;
+
 static void kwin_net_create_atoms() {
     if (!atoms_created){
 	const int max = 20;
@@ -1217,10 +1219,16 @@ QString KWin::readNameProperty( WId win,
 #endif
     QString result;
 #ifdef Q_WS_X11
-    if ( XGetTextProperty( qt_xdisplay(), win, &tp, atom ) != 0 && tp.value != NULL ) {
+    if ( XGetTextProperty( qt_xdisplay(), win, &tp, atom ) != 0 && tp.value != NULL ) 
+    {
+        if (!kwin_UTF8_STRING)
+          kwin_UTF8_STRING = XInternAtom( qt_xdisplay(), "UTF8_STRING", False);
+
         if ( XmbTextPropertyToTextList( qt_xdisplay(), &tp, &text, &count) == Success &&
                   text != NULL && count > 0 ) {
             result = QString::fromLocal8Bit( text[0] );
+        } else if ( tp.encoding == kwin_UTF8_STRING ) {
+            result = QString::fromUtf8 ( (const char*) tp.value );
         } else if ( tp.encoding == XA_STRING )
             result = QString::fromLocal8Bit( (const char*) tp.value );
         if( text != NULL )
openSUSE Build Service is sponsored by