When encode() is called to encode a mail header using "MIME-Q", it breaks the header at
apostrophes or colons resulting in extra whitespace when the header is unfolded by the MUA.
Example code:
#! /usr/local/bin/perl
use strict;
use Encode qw(encode);
print "Encode version $Encode::VERSION\n";
print encode('MIME-Q',"Subject: Bla Blahbla blah:Blahbl & Blahbla Bla Blah Bla Can't Blahb
Blahbla Bla. blah blah blah"),"\n";
print encode('MIME-Q',"Subject: Bla Blahbla blah:Blahbl & Blahbla Bla Blah Bla Cant Blahb
Blahbla Bla. blah blah blah"),"\n";
print encode('MIME-Q',"Subject: Bla Blahbla blah Blahbl & Blahbla Bla Blah Bla Cant Blahb
Blahbla Bla. blah blah blah"),"\n";
The output of the first line splits the word "Can't" at the apostrophe, and the second one it
splits after "blah:". In both cases when the MUA unfolds the lines, the extra whitespace
induced is retained, and the message headers, in this case the Subject, do not match the
original intent. The space after the ":" could be ignored, but the one in the middle of the
contraction "Can't" is totally wrong.
This seems related to the tickets: 40027, 63387, and 67569
Here's the output I see with Perl 5.10 and 5.12 on FreeBSD 8.2:
Encode version 2.43
Subject: Bla Blahbla blah:Blahbl & Blahbla Bla Blah Bla Can'
t Blahb Blahbla Bla. blah blah blah
Subject: Bla Blahbla blah:
Blahbl & Blahbla Bla Blah Bla Cant Blahb Blahbla Bla. blah blah blah
Subject:
Bla Blahbla blah Blahbl & Blahbla Bla Blah Bla Cant Blahb Blahbla Bla. blah blah blah