[evolution-patches] 41849, summary charset selection



i think the code was using the old libxml way of doing charsets (i.e.
not at all), this patch should make it work in most (all?) cases (in the
bug, libxml is converting the data to utf8 anyway).  depending on when
libxml converts to utf8 or not (always?).


Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/my-evolution/ChangeLog,v
retrieving revision 1.279
diff -u -3 -r1.279 ChangeLog
--- ChangeLog	18 Apr 2003 17:44:27 -0000	1.279
+++ ChangeLog	2 May 2003 02:06:55 -0000
@@ -1,3 +1,10 @@
+2003-05-02  Not Zed  <NotZed Ximian com>
+
+	[#41849]
+
+	* e-summary-rdf.c (tree_walk): check the in-memory charset, not
+	the transport charset when creating output.
+
 2003-04-18  Rodney Dawes  <dobey ximian com>
 
 	[#21499]
Index: e-summary-rdf.c
===================================================================
RCS file: /cvs/gnome/evolution/my-evolution/e-summary-rdf.c,v
retrieving revision 1.39
diff -u -3 -r1.39 e-summary-rdf.c
--- e-summary-rdf.c	27 Mar 2003 21:37:07 -0000	1.39
+++ e-summary-rdf.c	2 May 2003 02:06:55 -0000
@@ -180,6 +180,7 @@
 	int i;
 	char *t, *u;
 	char *tmp;
+	char *charset;
 
 	if (r->summary->preferences == NULL) {
 		limit = 10;
@@ -187,6 +188,15 @@
 		limit = r->summary->preferences->limit;
 	}
 
+	/* check in-memory encoding first, fallback to transport encoding, which may or may not be correct */
+	if (r->cache->charset == XML_CHAR_ENCODING_UTF8
+	    || r->cache->charset == XML_CHAR_ENCODING_ASCII) {
+		charset = NULL;
+	} else {
+		/* bad/missing encoding, fallback to latin1 (locale?) */
+		charset = r->cache->encoding?r->cache->encoding:"iso-8859-1";
+	}
+
 	/* FIXME: Need arrows */
 	if (r->shown == FALSE) {
 		char *p;
@@ -252,8 +262,8 @@
 	if (*u != '\0')
 		g_string_sprintfa (html, "<a href=\"%s\">", u);
 
-	if (r->cache->encoding) {
-		char *tmp = e_utf8_from_charset_string (r->cache->encoding, t);
+	if (charset) {
+		char *tmp = e_utf8_from_charset_string (charset, t);
 		g_string_append (html, tmp);
 		g_free (tmp);
 	} else {
@@ -278,9 +288,9 @@
 		tmp = g_strdup_printf ("<LI><font size=\"-1\"><A href=\"%s\">\n", layer_find_url(item[i]->children, "link", ""));
 		g_string_append (html, tmp);
 		g_free (tmp);
-		
-		if (r->cache->encoding) {
-			char *tmp = e_utf8_from_charset_string (r->cache->encoding, p);
+
+		if (charset) {
+			char *tmp = e_utf8_from_charset_string (charset, p);
 			g_string_append (html, tmp);
 			g_free (tmp);
 		} else {


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