rpms/gdm/F-8 gdm-2.20.5-fix-non-utf8.patch,NONE,1.1

Ray Strode (rstrode) fedora-extras-commits at redhat.com
Tue Jun 24 00:43:05 UTC 2008


Author: rstrode

Update of /cvs/pkgs/rpms/gdm/F-8
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv30563

Added Files:
	gdm-2.20.5-fix-non-utf8.patch 
Log Message:
add patch


gdm-2.20.5-fix-non-utf8.patch:

--- NEW FILE gdm-2.20.5-fix-non-utf8.patch ---
diff -up gdm-2.20.5/common/gdm-common.c.fix-non-utf8 gdm-2.20.5/common/gdm-common.c
--- gdm-2.20.5/common/gdm-common.c.fix-non-utf8	2008-06-23 20:25:29.000000000 -0400
+++ gdm-2.20.5/common/gdm-common.c	2008-06-23 20:27:53.000000000 -0400
@@ -211,6 +211,26 @@ ve_get_first_working_command (const char
 	return ret;
 }
 
+static char *
+get_valid_utf8 (const char *text)
+{
+	gchar *utf8_string, *escaped_string, *p;
+	const gchar *q;
+ 
+	utf8_string = g_strdup (text);
+	p = utf8_string;
+	while ((*p != '\0') && 
+	       !g_utf8_validate (p, -1, &q)) {
+		p = (gchar *) q;
+		*p = '?';
+		p++;
+	}
+ 
+	g_assert (g_utf8_validate (utf8_string, -1, NULL));
+ 
+	return utf8_string;
+}
+
 char *
 ve_locale_to_utf8 (const char *str)
 {
@@ -218,7 +238,7 @@ ve_locale_to_utf8 (const char *str)
 
 	if (ret == NULL) {
 		g_warning ("string not in proper locale encoding: \"%s\"", str);
-		return g_strdup (str);
+		return get_valid_utf8 (str);
 	} else {
 		return ret;
 	}




More information about the fedora-extras-commits mailing list