Re: Balsa exit with code 01 [SVN version]



Hi Nuno!

On 05/05/2007 11:02:26 AM Sat, Nuno Monteiro wrote:
[ snip ]
Sorry for rehashing an old thread, but while sifting through my 'attic'
mailbox (where I keep really old stuff) I came accross a couple of emails that crash Balsa with exit code 01, much like Jean-Luc's spams. They also have broken headers (attached, for your perusal), but Balsa 2.3.8 from Ubuntu 6.06 seems to eat them just fine without any complaints -- both mine and Jean-Luc's.

These seem to be UTF-8 problems. I get the same issues with various spam mails. The attached patch is an ad-hoc, shot-gun approach, cleaning up strings in various places, but it lets me view all of Jean-Luc's problematic mails. It requires recent GMime (g_mime_set_user_charsets, to be specific), which reflects Jeff's efforts along the same lines. I'd be interested to hear if it helps with your spam mails!

Best,

Peter
Index: src/balsa-mime-widget-text.c
===================================================================
--- src/balsa-mime-widget-text.c	(revision 7617)
+++ src/balsa-mime-widget-text.c	(working copy)
@@ -162,6 +162,8 @@
 	gchar *subject =
 	    g_strdup(LIBBALSA_MESSAGE_GET_SUBJECT(bm->message));
         
+	libbalsa_utf8_sanitize(&from,    balsa_app.convert_unknown_8bit, 
+			       NULL);
 	libbalsa_utf8_sanitize(&subject, balsa_app.convert_unknown_8bit, 
 			       NULL);
 	libbalsa_information
Index: src/balsa-message.c
===================================================================
--- src/balsa-message.c	(revision 7617)
+++ src/balsa-message.c	(working copy)
@@ -1085,10 +1085,14 @@
         if (g_ascii_strcasecmp(content_type, "message/rfc822") == 0 &&
             body->embhdrs) {
             gchar *from = balsa_message_sender_to_gchar(body->embhdrs->from, 0);
+            gchar *subj = g_strdup(body->embhdrs->subject);
+            libbalsa_utf8_sanitize(&from, balsa_app.convert_unknown_8bit, NULL);
+            libbalsa_utf8_sanitize(&subj, balsa_app.convert_unknown_8bit, NULL);
             icon_title = 
                 g_strdup_printf(_("rfc822 message (from %s, subject \"%s\")"),
-                                from, body->embhdrs->subject);
+                                from, subj);
             g_free(from);
+            g_free(subj);
         } else if (is_multipart) {
             icon_title = mpart_content_name(content_type);
 	    if (!strcmp(part_id, "1")) {
Index: libbalsa/misc.c
===================================================================
--- libbalsa/misc.c	(revision 7617)
+++ libbalsa/misc.c	(working copy)
@@ -520,6 +520,12 @@
 libbalsa_set_fallback_codeset(LibBalsaCodeset codeset)
 {     
     LibBalsaCodeset ret = sanitize_fallback_codeset;
+    const gchar *charsets[2];
+
+    charsets[0] = libbalsa_get_codeset_name(NULL, codeset);
+    charsets[1] = NULL;
+    g_mime_set_user_charsets(charsets);
+
     sanitize_fallback_codeset = codeset;
     return ret;
 }


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