Re: addresses from balsa-ab are not encoded properly



Hi Ildar:

On Aug 18, 2009, at  1:48 AM, Ildar Mulyukov wrote:
On 13.08.2009 16:46:06, Peter Bloomfield wrote:
If you paste the address directly into the address field, does the same thing happen? Looking over the code, I don't see any place where an address grabbed from an address book is handled any differently from one that's typed or pasted in, as far as encoding is concerned.

Yes, Peter. I see it better now:
  * If I Paste the address into the To: line, the bug is emerged
* If I type the address manually, the non-latin name is encoded just right

So nothing addr.book-specific.
Any ideas? If you need some more info, then let me know.

Hmm...well, pasting and entering from an address-book match both insert a block of text, whereas typing is one character at a time. The address widget does some low-level signal handling to catch the escape key, and also to strip newlines from blocks of text--just the sort of stuff that waits around to jump up and bite you. So finding some difference between block entry and character entry wouldn't be a huge surprise. But when you and I get different results from the same set of actions, I'm still mystified!

The attached patch dumps the To: address in hex when the message is created in the out-box or draft-box. Could you try it? It may offer some clue as to what the difference is.

Thanks!

Peter
diff --git a/libbalsa/send.c b/libbalsa/send.c
index 79d8d0f..7f464ff 100644
--- a/libbalsa/send.c
+++ b/libbalsa/send.c
@@ -1901,6 +1901,43 @@ libbalsa_message_create_mime_message(LibBalsaMessage* message, gboolean flow,
 
     recipients = g_mime_message_get_recipients(mime_message,
                                                GMIME_RECIPIENT_TYPE_TO);
+
+{                               /* begin debug */
+    guint i, len;
+    if (message->headers->to_list
+        && (len =
+            internet_address_list_length(message->headers->to_list) > 0)) {
+        for (i = 0; i < len; i++) {
+            InternetAddress *ia =
+                internet_address_list_get_address(message->
+                                                  headers->to_list, i);
+            const gchar *name, *addr;
+            if (INTERNET_ADDRESS_IS_GROUP(ia)) {
+                g_print("%s skipping group %s\n", __func__,
+                        internet_address_get_name(ia));
+                continue;
+            }
+            name = internet_address_get_name(ia);
+            g_print("%s name \"%s\", hex:", __func__, name);
+            while (*name) {
+                g_print(" %c", "0123456789abcdef"[(*name >> 4) & 0x0f]);
+                g_print("%c", "0123456789abcdef"[(*name) & 0x0f]);
+                ++name;
+            }
+            g_print("\n");
+            addr =
+                internet_address_mailbox_get_addr(INTERNET_ADDRESS_MAILBOX(ia));
+            g_print("%s address \"%s\", hex:", __func__, addr);
+            while (*addr) {
+                g_print(" %c", "0123456789abcdef"[(*addr >> 4) & 0x0f]);
+                g_print("%c", "0123456789abcdef"[(*addr) & 0x0f]);
+                ++addr;
+            }
+            g_print("\n");
+        }
+    }
+}                               /* end debug */
+
     internet_address_list_append(recipients, message->headers->to_list);
     
     recipients = g_mime_message_get_recipients(mime_message,


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