Brian Grayson wrote: > I downloaded 1.4 on Friday just to see, and the same problem > occurs. The fundamental problem is once the CTE code sees a > nonzero value of lobin, it goes into quoted, regardless of > whether hibin is nonzero. The following patch does the right > thing for my testcase here, but I don't know if there's a good > reason why the lobin/quotable check currently ignores whether > there are any hibins or not. > > After a bit of inspection, the file rep.5k has hibins and > _no_ lobins, and hence goes properly into 8bit encoding. But > the file rep1k has a lobin (0x0b at offset 0x340, for example), > so it short-circuits into quoted-printable. Try mailing the > base64-encoded version of that to yourself, and it should > choose quotable, even in 1.4.
Thanks for the extra info. I looked into this more closely, and I see that there are a couple of factors that come into play into this situation. First, I noticed that your PDF attachment was labeled improperly as "text/plain". This is not so bad in itself, but that piece of code that checks for which transfer encoding to use assumes that it really is text, which is a problem. Since there was no extension to the file, Mutt fell back into making a guess as to whether or not the file was of type text/plain or appliation/octet-stream. Mutt guessed text/plain because it saw only a few lobins in the file. However, Mutt failed to notice that there were bare CRs in the file when choosing the transfer encoding. The attach patch checks info->binary even for the text/plain case. I just tested this and it correctly chose base64 encoding for the file.
Index: sendlib.c =================================================================== RCS file: /home/roessler/cvs/mutt/sendlib.c,v retrieving revision 2.94.2.5 diff -u -r2.94.2.5 sendlib.c --- sendlib.c 31 May 2002 16:59:39 -0000 2.94.2.5 +++ sendlib.c 9 Sep 2002 16:32:21 -0000 @@ -1196,7 +1196,17 @@ if (b->type == TYPETEXT) { char *chsname = mutt_get_body_charset (send_charset, sizeof (send_charset), b); - if ((info->lobin && strncasecmp (chsname, "iso-2022", 8)) || info->linemax > 990 || (info->from && option (OPTENCODEFROM))) + + /* + * given a lack of info about what the file is from the mime-types file, + * Mutt will make a guess as to whether or not the file is likely + * text/plain or application/octet-stream based upon statistical + * evidence. It is still possible that a binary file (one with a bare + * CR) might occur, so we need to account for it here. + */ + if (info->binary) + b->encoding = ENCBASE64; + else if ((info->lobin && strncasecmp (chsname, "iso-2022", 8)) || info->linemax > +990 || (info->from && option (OPTENCODEFROM))) b->encoding = ENCQUOTEDPRINTABLE; else if (info->hibin) b->encoding = option (OPTALLOW8BIT) ? ENC8BIT : ENCQUOTEDPRINTABLE;