BUG: Quoted-Printable
Posted: Tue Dec 04, 2007 9:31 am
Hi Chris & everyone
First off, thanks for Swift - it's awesome!
I've come across a bug (PHP5, latest build, using SMTP) with Quoted-Printable encoding.
It seems like you already know about it - it's related to the last changeset:
http://swiftmailer.svn.sourceforge.net/ ... 462&r2=466
Re: the changeset above: from what I can tell, this was just a quick fix as it is essentially halting the second part of QP-encoding (line length stuff) from that point of the string on. This is one part of my problem as this is happening a short way into a much longer string (e.g. below)
The other problem is that with this fix, the resulting output contains an extra hard break at the point where it skipped.
Less of a bug but still not ideal, I noticed how Swift inserts hard breaks (with " =\r\n") at the end of *every* line, not just when required. This is giving rather messy output encoding, even if it is valid. I see you mentioned that QP needs a rethink in your announcement about v4, so added to the fact that it seems like you know about my first problem I wanted to know if you had any specific plans in store for updating the encoding?
Example text causing the bug (note that this contains intentional hard line breaks):
Resultant QP output from Swift:
Note that in this example the desired QP output (e.g. given correctly by http://www.motobit.com/util/quoted-prin ... ncoder.asp) is actually the same as the input since it contains no non-printable chars and i've already word-wrapped it.
So, in summary(!), the code inserted in the last changeset is being activated just after the last "=" inserted, when the remaining string starts with a newline - at this point neither of the preg's match and the remaining QP encoding to be done is being abandoned, and also gives an erroneous hard break at this point.
As a workaround for now, I've stolen the QP encoding function from http://pear.php.net/package/Mail_Mime (_quotedPrintableEncode() on http://cvs.php.net/viewvc.cgi/pear/Mail ... iew=markup) and inserted this at the top of QPEncode:
Obviously this hack smells bad - I was wondering if you'd looked into this function before when working out the method to do the QP encoding, and whether there's any reason why it may not be a good solution?
Thanks a lot, and I hope this helps make Swift even better!
-- Andy
First off, thanks for Swift - it's awesome!
I've come across a bug (PHP5, latest build, using SMTP) with Quoted-Printable encoding.
It seems like you already know about it - it's related to the last changeset:
http://swiftmailer.svn.sourceforge.net/ ... 462&r2=466
Re: the changeset above: from what I can tell, this was just a quick fix as it is essentially halting the second part of QP-encoding (line length stuff) from that point of the string on. This is one part of my problem as this is happening a short way into a much longer string (e.g. below)
The other problem is that with this fix, the resulting output contains an extra hard break at the point where it skipped.
Less of a bug but still not ideal, I noticed how Swift inserts hard breaks (with " =\r\n") at the end of *every* line, not just when required. This is giving rather messy output encoding, even if it is valid. I see you mentioned that QP needs a rethink in your announcement about v4, so added to the fact that it seems like you know about my first problem I wanted to know if you had any specific plans in store for updating the encoding?
Example text causing the bug (note that this contains intentional hard line breaks):
Code: Select all
Dear OxHub members,
We're just too good to you. In case you have any free time amongst all the
ice-skating and shopping this December, we've put together a **summary list
of events** going on in Oxford, London and elsewhere. I'd be happy to send
out information about things we've missed off next week if people send them
to me.
Finally, in an unashamed rip off of an Independent front page of a while
back: No Oxhub news today. 'Just 6,500 Africans died today as a result of a
preventable, treatable disease.' Our **call to action for World AIDS Week**
is listed below. ...(continues)Code: Select all
Dear OxHub members,
=
We're just too good to you. In case you have any free time amongst all th=
e
ic=
e-skating and shopping this December, we've put together a **summary list=
of=
events** going on in Oxford, London and elsewhere. I'd be happy to send
=
out information about things we've missed off next week if people send them
to me.
Finally, in an unashamed rip off of an Independent front page of a while
back: No Oxhub news today. 'Just 6,500 Africans died today as a result of a
preventable, treatable disease.' Our **call to action for World AIDS Week**
is listed below. ...(continues)So, in summary(!), the code inserted in the last changeset is being activated just after the last "=" inserted, when the remaining string starts with a newline - at this point neither of the preg's match and the remaining QP encoding to be done is being abandoned, and also gives an erroneous hard break at this point.
As a workaround for now, I've stolen the QP encoding function from http://pear.php.net/package/Mail_Mime (_quotedPrintableEncode() on http://cvs.php.net/viewvc.cgi/pear/Mail ... iew=markup) and inserted this at the top of QPEncode:
Code: Select all
public function QPEncode($data, $chunk=76, $init_chunk=0, $headers=false, $le="\r\n")
{
if (!$headers) {
return $this->_quotedPrintableEncode($data, $chunk, $le);
}Thanks a lot, and I hope this helps make Swift even better!
-- Andy