Skip Menu |

This queue is for tickets about the Encode CPAN distribution.

Report information
The Basics
Id: 63387
Status: resolved
Priority: 0/
Queue: Encode

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

Bug Information
Severity: Important
Broken in: 2.40
Fixed in: (no value)



Subject: encode of MIME-Header inserts too much whitespace
This is probably related to the decode bug: https://rt.cpan.org/Ticket/Display.html?id=40027 Breaking an e-mail address at a period causes it to decode with extra whitespace, which is then interpreted incorrectly by something between Email::Sender::Simple and my ISP's smtp server (the part of the address after the space is ignored). I'm not sure who is wrong here, but my reading of RFC 2822 is that folding always adds a space, so should only be done where that is acceptable. perl -MEncode -e ' my $x = q("International association of long names") . q( <blahblahblahblah@whatever.example.com>); warn Encode::encode("MIME-Header", $x, 1);' "International association of long names"&nbsp;<blahblahblahblah@whatever. example.com> at -e line 4. (This example does not need encoding, but that shouldn't matter.) When the mail is saved out as a string and then read back in by the sender, it expects to get the recipients out of the 'To' header. The attached patch makes this problem go away, but perhaps the trouble is that Email::Simple is unfolding incorrectly? Given that the debate of bug #40027 seems unresolved, I don't know what to think about how to fix this. Thanks, Eric
Subject: encode-mime-header.patch
diff --git a/lib/Encode/MIME/Header.pm b/lib/Encode/MIME/Header.pm index 5f209b2..7fb2784 100644 --- a/lib/Encode/MIME/Header.pm +++ b/lib/Encode/MIME/Header.pm @@ -95,7 +95,7 @@ sub decode_q { my $especials = join( '|' => map { quotemeta( chr($_) ) } - unpack( "C*", qq{()<>@,;:"'/[]?.=} ) ); + unpack( "C*", qq{()<>,;:"'/[]?=} ) ); my $re_encoded_word = qr{ =\? # begin encoded word
(RT eats whitespace while we're trying to discuss a bug about whitespace... Brilliant. See attached for unmangled example.)
Subject: example.txt
perl -MEncode -e ' my $x = q("International association of long names") . q( <blahblahblahblah@whatever.example.com>); warn Encode::encode("MIME-Header", $x, 1);' "International association of long names" <blahblahblahblah@whatever. example.com> at -e line 4.
Thanks, applied in the repository. Dan the Maintainer Thereof On Sat Nov 27 15:36:27 2010, EWILHELM wrote: Show quoted text
> This is probably related to the decode bug: > https://rt.cpan.org/Ticket/Display.html?id=40027 > > Breaking an e-mail address at a period causes it to decode with extra > whitespace, which is then interpreted incorrectly by something between > Email::Sender::Simple and my ISP's smtp server (the part of the > address after the space is ignored). I'm not sure who is wrong here, > but my reading of RFC 2822 is that folding always adds a space, so > should only be done where that is acceptable. > > perl -MEncode -e ' > my $x = q("International association of long names") . > q( <blahblahblahblah@whatever.example.com>); > warn Encode::encode("MIME-Header", $x, 1);' > "International association of long > names"&nbsp;<blahblahblahblah@whatever. > example.com> at -e line 4. > > (This example does not need encoding, but that shouldn't matter.) > > When the mail is saved out as a string and then read back in by the > sender, it expects to get the recipients out of the 'To' header. The > attached patch makes this problem go away, but perhaps the trouble is > that Email::Simple is unfolding incorrectly? > > Given that the debate of bug #40027 seems unresolved, I don't know > what to think about how to fix this. > > Thanks, > Eric