diff src/video/x11/SDL_x11wm.c @ 1505:4d005dfbb7f5

Fixed bug #139 The text in SDL_WM_SetCaption() is in UTF-8 encoding.
author Sam Lantinga <slouken@libsdl.org>
date Mon, 13 Mar 2006 01:33:58 +0000
parents d910939febfa
children b46bb79cc197
line wrap: on
line diff
--- a/src/video/x11/SDL_x11wm.c	Mon Mar 13 01:20:05 2006 +0000
+++ b/src/video/x11/SDL_x11wm.c	Mon Mar 13 01:33:58 2006 +0000
@@ -255,8 +255,13 @@
 				&titleprop);
 #endif
 		if ( error != Success ) {
-			pXStringListToTextProperty((char **)&title, 1,
-					&titleprop);
+			char *title_latin1 = SDL_iconv_utf8_latin1((char *)title);
+			if ( !title_latin1 ) {
+				SDL_OutOfMemory();
+				return;
+			}
+			pXStringListToTextProperty(&title_latin1, 1, &titleprop);
+			SDL_free(title_latin1);
 		}
 		pXSetWMName(SDL_Display, WMwindow, &titleprop);
 		pXFree(titleprop.value);
@@ -268,7 +273,13 @@
 				(char **)&icon, 1, XUTF8StringStyle, &iconprop);
 #endif
 		if ( error != Success ) {
-			pXStringListToTextProperty((char **)&icon, 1, &iconprop);
+			char *icon_latin1 = SDL_iconv_utf8_latin1((char *)title);
+			if ( !icon_latin1 ) {
+				SDL_OutOfMemory();
+				return;
+			}
+			pXStringListToTextProperty(&icon_latin1, 1, &iconprop);
+			SDL_free(icon_latin1);
 		}
 		pXSetWMIconName(SDL_Display, WMwindow, &iconprop);
 		pXFree(iconprop.value);