Skip Menu |

This queue is for tickets about the Encode CPAN distribution.

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

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

Bug Information
Severity: Critical
Broken in:
  • 2.42
  • 2.43
Fixed in: 2.83



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
I agree with this report. Line folding should only occur at whitespace. I'd prefer if there was a mime header encoding routine that did not fold, but left it up to the message-handling code. -- rjbs
Subject: MIME-Q breaks the header at apostrophes or colons
On Ned Júl 17 11:37:42 2011, VKHERA wrote: Show quoted text
> 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
Fixed in Encode 2.83.