[reportlab-users] Re: pdf's corrupted when emailed, possible solution included

Jeff Johnson reportlab-users@reportlab.com
Thu, 15 Apr 2004 13:35:56 -0400


Tim Roberts wrote:

> On Wed, 14 Apr 2004 11:28:38 -0400, Jeff Johnson <jjohnson@deg.cc> wrote:
>
>> Hi, we're using reportlab 1.18 and since we've switched to a postfix 
>> mail server on linux, our PDFs that are sent from Outlook are 
>> corrupted.  This is apparently because Outlook uses quoted-printable 
>> encoding instead of base64 to encode the PDF when it doesn't see 
>> binary data in the first few lines of the attachment.
>>
>
> Even if this is true, I'm not sure what the problem is.  
> Quoted-printable is quite capable of representing binary data.  A 
> binary file grows more when encoded as QP than when encoded as base64, 
> but it doesn't lose any information.  Where does the corruption occur?
>
The problem is with the linefeeds.  When going from Windows to Unix, the 
linefeeds _may_ be converted from CRLF to LF.  I'm no expert on the 
issue but I think it was either vague or even explicitly allowed in the 
qp specification that linefeeds can be converted to whatever the local 
OS uses.  I've seen some posts that suggest quoted-printable should 
_always_ use CRLF regardless of the OS.  Maybe that is now, or always 
was, part of the quoted-printable spec.

So far, the testing I've done from Outlook does not show any problems, 
I'm still trying to reproduce the problem that was reported to me.

Regards,
Jeff