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" <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