gdm/gdm-2.18.0-dont-expect-utf8.patch
2007-04-05 16:20:19 +00:00

70 lines
2.3 KiB
Diff

--- gdm-2.18.0/gui/gdmlogin.c.dont-expect-utf8 2007-04-05 12:02:47.000000000 -0400
+++ gdm-2.18.0/gui/gdmlogin.c 2007-04-05 12:03:24.000000000 -0400
@@ -2042,8 +2042,8 @@
char *label;
char *login, *gecos;
- login = g_markup_escape_text (usr->login, -1);
- gecos = g_markup_escape_text (usr->gecos, -1);
+ login = gdm_common_text_to_escaped_utf8 (usr->login);
+ gecos = gdm_common_text_to_escaped_utf8 (usr->gecos);
label = g_strdup_printf ("<b>%s</b>\n%s",
login,
--- gdm-2.18.0/gui/gdmcommon.c.dont-expect-utf8 2007-04-05 11:59:23.000000000 -0400
+++ gdm-2.18.0/gui/gdmcommon.c 2007-04-05 12:02:29.000000000 -0400
@@ -379,6 +379,29 @@
return pixbuf;
}
+gchar *
+gdm_common_text_to_escaped_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));
+
+ escaped_string = g_markup_escape_text (utf8_string, -1);
+ g_free (utf8_string);
+
+ return escaped_string;
+}
+
gchar *
gdm_common_get_config_file (void)
{
--- gdm-2.18.0/gui/gdmcommon.h.dont-expect-utf8 2007-04-05 11:59:37.000000000 -0400
+++ gdm-2.18.0/gui/gdmcommon.h 2007-04-05 12:00:40.000000000 -0400
@@ -58,6 +58,7 @@
guint max_width,
guint max_height);
+gchar* gdm_common_text_to_escaped_utf8 (const char *text);
gchar* gdm_common_get_config_file (void);
gchar* gdm_common_get_custom_config_file (void);
gboolean gdm_common_select_time_format (void);
--- gdm-2.18.0/gui/greeter/greeter_item_ulist.c.dont-expect-utf8 2007-04-05 11:59:05.000000000 -0400
+++ gdm-2.18.0/gui/greeter/greeter_item_ulist.c 2007-04-05 12:02:09.000000000 -0400
@@ -181,9 +181,9 @@
gboolean active;
if (usr->gecos && strcmp (usr->gecos, "") != 0) {
- name = g_markup_escape_text (usr->gecos, -1);
+ name = gdm_common_text_to_escaped_utf8 (usr->gecos);
} else {
- name = g_markup_escape_text (usr->login, -1);
+ name = gdm_common_text_to_escaped_utf8 (usr->login);
}
if (g_hash_table_lookup (displays_hash, usr->login))