<<< Date Index >>>     <<< Thread Index >>>

attachment file name is not decoded



Hi, all

The filename of attachments is not decoded with rfc2048.

I'm using mutt on Fedora Core 1.
and it recommends the utf-8 character set.
in japanese, we often attach a file to the mail, which contained multibyte character.
(of course, i _don't_ do such a thing. ;-)

Then, we can't see the real filename on mutt.
(It is encoded with base64)

I made a patch for this problem.
Please check and include.

Thanks.

_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail
Index: recvattach.c
===================================================================
RCS file: /home/roessler/cvs/mutt/recvattach.c,v
retrieving revision 3.12
diff -c -r3.12 recvattach.c
*** recvattach.c        4 Oct 2003 20:35:00 -0000       3.12
--- recvattach.c        4 Feb 2004 05:43:17 -0000
***************
*** 21,26 ****
--- 21,27 ----
 #include "mutt_curses.h"
 #include "mutt_menu.h"
 #include "rfc1524.h"
+ #include "rfc2047.h"
 #include "mime.h"
 #include "mailbox.h"
 #include "attach.h"
***************
*** 244,259 ****
     case 'f':
       if(!optional)
       {
        if (aptr->content->filename && *aptr->content->filename == '/')
        {
          char path[_POSIX_PATH_MAX];

!         strfcpy (path, aptr->content->filename, sizeof (path));
          mutt_pretty_mailbox (path);
          mutt_format_s (dest, destlen, prefix, path);
        }
        else
! mutt_format_s (dest, destlen, prefix, NONULL (aptr->content->filename));
       }
       else if(!aptr->content->filename)
         optional = 0;
--- 245,269 ----
     case 'f':
       if(!optional)
       {
+       char *dest_dup;
        if (aptr->content->filename && *aptr->content->filename == '/')
        {
          char path[_POSIX_PATH_MAX];

!         dest_dup = safe_strdup (NONULL (aptr->content->filename));
!         rfc2047_decode (&dest_dup);
!         strfcpy (path, dest_dup, sizeof (path));
!         FREE (&dest_dup);
          mutt_pretty_mailbox (path);
          mutt_format_s (dest, destlen, prefix, path);
        }
        else
!       {
!         dest_dup = safe_strdup (NONULL (aptr->content->filename));
!         rfc2047_decode (&dest_dup);
!         mutt_format_s (dest, destlen, prefix, dest_dup);
!         FREE (&dest_dup);
!       }
       }
       else if(!aptr->content->filename)
         optional = 0;
***************
*** 338,343 ****
--- 348,354 ----
     mutt_FormatString (dest, destlen, ifstring, mutt_attach_fmt, data, 0);
   else if (flags & M_FORMAT_OPTIONAL)
mutt_FormatString (dest, destlen, elsestring, mutt_attach_fmt, data, 0);
+
   return (src);
 }

***************
*** 374,383 ****
--- 385,400 ----

   if (body->filename)
   {
+     char *dest_dup;
     if (directory && *directory)
mutt_concat_path (buf, *directory, mutt_basename (body->filename), sizeof (buf));
     else
       strfcpy (buf, body->filename, sizeof (buf));
+
+     dest_dup = safe_strdup (buf);
+     rfc2047_decode (&dest_dup);
+     strfcpy (buf, dest_dup, sizeof (buf));
+     FREE (&dest_dup);
   }
   else if(body->hdr &&
          body->encoding != ENCBASE64 &&
***************
*** 450,455 ****
--- 467,473 ----
   int rc = 1;
   int last = menu ? menu->current : -1;
   FILE *fpout;
+   char *dest_dup;

   buf[0] = 0;

***************
*** 463,469 ****
        {
          int append = 0;

!         strfcpy (buf, NONULL (top->filename), sizeof (buf));
          if (mutt_get_field (_("Save to file: "), buf, sizeof (buf),
                                    M_FILE | M_CLEAR) != 0 || !buf[0])
            return;
--- 481,490 ----
        {
          int append = 0;

!         dest_dup = safe_strdup (NONULL(top->filename));
!         rfc2047_decode (&dest_dup);
!         strfcpy (buf, dest_dup, sizeof (buf));
!         FREE (&dest_dup);
          if (mutt_get_field (_("Save to file: "), buf, sizeof (buf),
                                    M_FILE | M_CLEAR) != 0 || !buf[0])
            return;