Re: [evolution-patches] patch for fix non rfc2047 compliant i18n mailer



Hi all,

Here is the newest patch. Tested and works fine.

Cantona.
? shell/shell-errors.xml.h
Index: camel/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/camel/ChangeLog,v
retrieving revision 1.2152
diff -u -r1.2152 ChangeLog
--- a/camel/ChangeLog	27 May 2004 17:56:51 -0000	1.2152
+++ b/camel/ChangeLog	30 May 2004 11:10:30 -0000
@@ -1,3 +1,10 @@
+2004-05-30  Cantona Su  <paradisetux hotmail com>
+										
+	* camel-mime-utils.c (fix_broken_rfc2047): Added fix_broken_rfc2047()
+	for fix non rfc2047 compliant i18n mailer. #58555
+	(camel_header_decode_string): call fix_broken_rfc2047() before return
+	the string to header_decode_text().					
+
 2004-05-27  Jeffrey Stedfast  <fejj novell com>
 
 	Fixes bug #59191.
Index: camel/camel-mime-utils.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/camel-mime-utils.c,v
retrieving revision 1.208
diff -u -r1.208 camel-mime-utils.c
--- a/camel/camel-mime-utils.c	24 May 2004 08:02:10 -0000	1.208
+++ b/camel/camel-mime-utils.c	30 May 2004 11:10:32 -0000
@@ -1171,10 +1171,58 @@
 
 char *
 camel_header_decode_string (const char *in, const char *default_charset)
-{
+{	
 	if (in == NULL)
 		return NULL;
-	return header_decode_text (in, strlen (in), default_charset);
+	
+	return header_decode_text (fix_broken_rfc2047(in), strlen (fix_broken_rfc2047(in)), default_charset);
+}
+
+/* fix for non rfc2047 compliant i18n mailers */
+static char *
+fix_broken_rfc2047(const char *in)
+{
+	GString *out;
+	const char *start, *temp, *str;
+	int len, i;
+        
+	str = in;
+	out = g_string_new ("");
+	
+	do {
+		start = strstr(str, "=?");
+		
+		if ((temp = strstr(str, "?B?")) == NULL)
+			temp = strstr(str, "?b?");
+			
+		if (start && !temp && (start = strstr(str+2, "=?"))) {
+			len = start - str;
+		} else if (start && temp && (start = strstr(str+2, "=?="))) {
+                	len = start - str + 3;
+		} else {
+			len = start - str;
+		}
+
+		g_string_append_len(out, str, len);
+		g_string_append_c(out, ' ');
+		temp = out->str;
+		
+		if (i = strrchr(temp, '=') != NULL) {
+			i = strrchr(temp, '=' ) - temp + 1;
+		
+			if (i > 0 && temp[i-2] == '?' && !camel_mime_is_lwsp(temp[i]))
+				g_string_insert_c(out, i, ' ');
+		}
+
+		if(start >= str) 
+			str += len;
+
+		temp = NULL;
+        } while (start != NULL);
+
+	str = out->str;
+	g_string_free(out, FALSE);
+	return str;
 }
 
 /* how long a sequence of pre-encoded words should be less than, to attempt to 


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