[evolution-patches] fix for bug #73945



I thought I remembered Zucchi working on a fix for this problem (prob a
diff bug # tho?) but it doesn't seem it ever went in, so here's another
go at a fix.

-- 
Jeffrey Stedfast
Evolution Hacker - Novell, Inc.
fejj ximian com  - www.novell.com
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/ChangeLog,v
retrieving revision 1.2442
diff -u -r1.2442 ChangeLog
--- ChangeLog	4 Apr 2005 19:09:20 -0000	1.2442
+++ ChangeLog	7 Apr 2005 18:10:43 -0000
@@ -1,3 +1,9 @@
+2005-04-07  Jeffrey Stedfast  <fejj novell com>
+
+	* camel-mime-utils.c (camel_header_encode_string): If
+	camel_charset_best() returns NULL, default to UTF-8.
+	(camel_header_encode_phrase): Same as above.
+
 2005-03-31  Jeffrey Stedfast  <fejj novell com>
 
 	* camel-sasl-digest-md5.c (camel_sasl_digest_md5_finalize): If the
Index: camel-mime-utils.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/camel-mime-utils.c,v
retrieving revision 1.227
diff -u -r1.227 camel-mime-utils.c
--- camel-mime-utils.c	25 Mar 2005 18:17:16 -0000	1.227
+++ camel-mime-utils.c	7 Apr 2005 18:10:44 -0000
@@ -1272,6 +1272,7 @@
 	const unsigned char *inptr = in, *start, *word;
 	gboolean last_was_encoded = FALSE;
 	gboolean last_was_space = FALSE;
+	const char *charset;
 	int encoding;
 	GString *out;
 	char *outstr;
@@ -1335,8 +1336,9 @@
 				if (last_was_encoded)
 					g_string_append_c (out, ' ');
 				
-				rfc2047_encode_word (out, start, inptr - start,
-						     camel_charset_best (start, inptr - start), CAMEL_MIME_IS_ESAFE);
+				if (!(charset = camel_charset_best (start, inptr - start)))
+					charset = "UTF-8";
+				rfc2047_encode_word (out, start, inptr - start, charset, CAMEL_MIME_IS_ESAFE);
 				last_was_encoded = TRUE;
 				break;
 			}
@@ -1381,8 +1383,9 @@
 			if (last_was_encoded)
 				g_string_append_c (out, ' ');
 			
-			rfc2047_encode_word (out, start, inptr - start,
-					     camel_charset_best (start, inptr - start - 1), CAMEL_MIME_IS_ESAFE);
+			if (!(charset = camel_charset_best (start, inptr - start)))
+				charset = "UTF-8";
+			rfc2047_encode_word (out, start, inptr - start, charset, CAMEL_MIME_IS_ESAFE);
 			break;
 		}
 	}
@@ -1570,6 +1573,7 @@
 {
 	struct _phrase_word *word = NULL, *last_word = NULL;
 	GList *words, *wordl;
+	const char *charset;
 	GString *out;
 	char *outstr;
 	
@@ -1621,11 +1625,13 @@
 				start = word->start;
 			}
 			
-			if (word->encoding == 1)
+			if (word->encoding == 1) {
 				rfc2047_encode_word (out, start, len, "ISO-8859-1", CAMEL_MIME_IS_PSAFE);
-			else
-				rfc2047_encode_word (out, start, len,
-						     camel_charset_best (start, len), CAMEL_MIME_IS_PSAFE);
+			} else {
+				if (!(charset = camel_charset_best (start, len)))
+					charset = "UTF-8";
+				rfc2047_encode_word (out, start, len, charset, CAMEL_MIME_IS_PSAFE);
+			}
 			break;
 		}
 		

Attachment: smime.p7s
Description: S/MIME cryptographic signature



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