Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Email-MIME-Encodings CPAN distribution.

Report information
The Basics
Id: 44709
Status: resolved
Priority: 0/
Queue: Email-MIME-Encodings

People
Owner: Nobody in particular
Requestors: mkanat [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.311
Fixed in: (no value)



Subject: quoted-printable encoding does not correctly encode emails that already have CRLF lines
Download (untitled) / with headers
text/plain 708b
As of Bugzilla 3.2.3, we generate emails that end in CRLF before we send them to Email::MIME::Modifier's encoding_set(). By default, it seems that MIME::QuotedPrint encodes CR as =0D and does not encode LF, which is illegal according to Rule 1 for Quoted-Printable: http://www.freesoft.org/CIE/RFC/1521/6.htm (It is illegal since per RFC822 [and I believe RFC2822 also]), all email lines must end in CRLF, so that is the standard line terminator for this transport. There is an $eol option to MIME::QuotedPrint to help with this, but I'm not sure that it will in fact actually help. I think Email::MIME::Encodings will have to s/\015\012$/\012/ms and then give \015\012 as the $eol argument to encode_qp.
Download (untitled) / with headers
text/plain 185b
I have attached a patch that should fix this. It hasn't been tested, but I did something similar for Bugzilla, tested it, and it worked there. I did check if this compiles, and it does.
Download qp-crlf.diff
text/x-diff 1k
--- Encodings.pm 2009-03-31 18:59:38.000000000 -0700 +++ Encodings.pm.new 2009-03-31 19:10:19.000000000 -0700 @@ -23,7 +23,22 @@ require Carp; Carp::croak("Don't know how to $which $how"); } - $sub->($what); + # RFC2822 requires all email lines to end in CRLF. The Quoted-Printable + # RFC requires CRLF to not be encoded, in emails. The only way to achieve + # this with MIME::QuotedPrint is to replace all CRLFs with just LF and + # then let MIME::QuotedPrint replace all LFs with CRLF. Otherwise + # MIME::QuotedPrint (by default) encodes CR as =0D, which is against RFCs + # and breaks MUAs (such as Thunderbird). + # + # We don't modify data before Base64 encoding it because that is usually + # binary data and modifying it at all is a bad idea. We do however specify + # that the encoder should end lines with CRLF (since that's the email + # standard). + my $eol = "\015\012"; + if ($how eq 'qp') { + $what =~ s/$eol/\012/sg; + } + $sub->($what, $eol); } sub decode { return codec("decode", @_) }
1.313 -- rjbs


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.