[evolution-patches] UTF8 conversion fix



Hi all,

the attach patch ensure g_get_real_name value is a valid UTF-8 string
and convert it from local encoding to UTF-8 if not. This fixes a pango
warning/Full name truncation I saw in New Mail account wizard.

Can I commit this (probably to 1.4 branch and HEAD) ?
-- 
Frederic Crozat <fcrozat mandrakesoft com>
Mandrakesoft
? evolution-1.4.5-utf8user.patch
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.2761.2.28
diff -u -r1.2761.2.28 ChangeLog
--- ChangeLog	30 Sep 2003 18:50:14 -0000	1.2761.2.28
+++ ChangeLog	1 Oct 2003 15:08:24 -0000
@@ -1,3 +1,8 @@
+2003-10-01  Frederic Crozat  <fcrozat mandrakesoft com>
+
+	* mail-config-druid.c: (identity_prepare), (config_wizard_new):
+	Convert real name to UTF-8 if needed.
+
 2003-09-30  Rodney Dawes  <dobey ximian com>
 
 	* mail-callbacks.c: Use "Sans Regular" instead of "Helvetica"
Index: mail-config-druid.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-config-druid.c,v
retrieving revision 1.100
diff -u -r1.100 mail-config-druid.c
--- mail-config-druid.c	16 Apr 2003 17:03:11 -0000	1.100
+++ mail-config-druid.c	1 Oct 2003 15:08:24 -0000
@@ -140,7 +140,16 @@
 	name = gtk_entry_get_text (mcw->gui->full_name);
 	if (!name) {
 		name = g_get_real_name ();
-		gtk_entry_set_text (mcw->gui->full_name, name ? name : "");
+		if (name && !g_utf8_validate (name, -1, NULL)) {
+			char *converted_name;
+			
+			converted_name = g_locale_to_utf8 (name, -1, NULL, NULL, NULL);
+			gtk_entry_set_text (mcw->gui->full_name, converted_name ? converted_name : "");
+			g_free (converted_name);
+		}
+		else {
+			gtk_entry_set_text (mcw->gui->full_name, name ? name : "");
+		}
 		gtk_editable_select_region (GTK_EDITABLE (mcw->gui->full_name), 0, -1);
 	}
 	gtk_widget_grab_focus (GTK_WIDGET (mcw->gui->full_name));
@@ -488,7 +497,14 @@
 	account->enabled = TRUE;
 	
 	name = g_get_real_name ();
-	account->id->name = g_strdup (name);
+	if (name && !g_utf8_validate (name, -1, NULL)) {
+		char *converted_name;
+			
+		account->id->name = g_locale_to_utf8 (name, -1, NULL, NULL, NULL);
+		}
+	else {
+		account->id->name = g_strdup (name);
+	}
 	user = g_get_user_name ();
 	if (user && !uname (&uts) && strchr (uts.nodename, '.'))
 		account->id->address = g_strdup_printf ("%s %s", user, uts.nodename);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]