Skip Menu |

This queue is for tickets about the Encode CPAN distribution.

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

People
Owner: Nobody in particular
Requestors: ppisar [...] redhat.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 2.79
Fixed in: (no value)



Subject: 2.79 breaks Email-MIME-1.936 tests
When running Email-MIME-1.936 tests with Encode-2.79, I can see this failure: t/singlepart.t ......... ok # Failed test 'Subject header is correct' # at t/unicode.t line 83. # got: 'test test test test test test test test t�st te (12 34)' # expected: 'test test test test test test test test t�st te (12 34)' # Failed test 'Subject header is correct' # at t/unicode.t line 83. # got: 'test test test test test test test test t�st te (12 34)' # expected: 'test test test test test test test test t�st te (12 34)' # Looks like you failed 2 tests of 27. t/unicode.t ............ Dubious, test returned 2 (wstat 512, 0x200) You can see a space was added. If I revert this Encode change: --- a/lib/Encode/MIME/Header.pm +++ b/lib/Encode/MIME/Header.pm @@ -40,9 +40,6 @@ sub decode($$;$) { use utf8; my ( $obj, $str, $chk ) = @_; - # zap spaces between encoded words - $str =~ s/\?=\s+=\?/\?==\?/gos; - # multi-line header to single line $str =~ s/(?:\r\n|[\r\n])[ \t]//gos; introduced by commit: commit b14a812a86f7e586ac22e9410ffc50aa5dc3969a Author: Dan Kogai <dankogai+github@gmail.com> Date: Fri Jan 22 15:19:13 2016 +0900 address https://rt.cpan.org/Ticket/Display.html?id=88717 the test pass Email-MIME tests pass again, but Encode's tests fail: t/mime-header.t ............ 1/14 # Failed test 'decode B' # at t/mime-header.t line 101. Wide character in print at /usr/share/perl5/vendor_perl/Test/Builder.pm line 1826. # got: 'From: 小飼弾 <dankogai@dan.co.jp> # To: dankogai@dan.co.jp (小飼=Kogai,弾=Dan) # Subject: 漢字、カタカナ、ひらがなを含む、非常に長いタイトル行が一体全体どのよ うにしてEncodeされるのか? # ' # expected: 'From: 小飼 弾 <dankogai@dan.co.jp> # To: dankogai@dan.co.jp (小飼=Kogai, 弾=Dan) # Subject: 漢字、カタカナ、ひらがなを含む、非常に長いタイトル行が一体全体どのよ うにしてEncodeされるのか? # ' and the same for B encoding. Reading the RFC section as quoted in the CPAN RT#88717 brings me to conclusion, that this is Encode's fault. I think the MIME::Header::decode() should remove spaces separating the encoded-word from other text or encoded-words. And this feature was removed by the above mentioned diff hunk. What's your opinion?
Mea culpa. Your claim is all valid. The following will fix it. https://github.com/dankogai/p5-encode/commit/77c0a92d8d12f06a3d92ea3d798ec81170b9202b Verified myself w/ Email-MIME-1.936. Encode::VERSION++ soon to follow. Dan the Maintainer Thereof On Mon Jan 25 08:27:42 2016, ppisar wrote: Show quoted text
> When running Email-MIME-1.936 tests with Encode-2.79, I can see this > failure: > > t/singlepart.t ......... ok > # Failed test 'Subject header is correct' > # at t/unicode.t line 83. > # got: 'test test test test test test test test t�st te (12 > 34)' > # expected: 'test test test test test test test test t�st te (12 > 34)' > # Failed test 'Subject header is correct' > # at t/unicode.t line 83. > # got: 'test test test test test test test test t�st te (12 > 34)' > # expected: 'test test test test test test test test t�st te (12 > 34)' > # Looks like you failed 2 tests of 27. > t/unicode.t ............ > Dubious, test returned 2 (wstat 512, 0x200) > > You can see a space was added. > > If I revert this Encode change: > > --- a/lib/Encode/MIME/Header.pm > +++ b/lib/Encode/MIME/Header.pm > @@ -40,9 +40,6 @@ sub decode($$;$) { > use utf8; > my ( $obj, $str, $chk ) = @_; > > - # zap spaces between encoded words > - $str =~ s/\?=\s+=\?/\?==\?/gos; > - > # multi-line header to single line > $str =~ s/(?:\r\n|[\r\n])[ \t]//gos; > > introduced by commit: > > commit b14a812a86f7e586ac22e9410ffc50aa5dc3969a > Author: Dan Kogai <dankogai+github@gmail.com> > Date: Fri Jan 22 15:19:13 2016 +0900 > > address https://rt.cpan.org/Ticket/Display.html?id=88717 > > the test pass Email-MIME tests pass again, but Encode's tests fail: > > t/mime-header.t ............ 1/14 > # Failed test 'decode B' > # at t/mime-header.t line 101. > Wide character in print at > /usr/share/perl5/vendor_perl/Test/Builder.pm line 1826. > # got: 'From: 小飼弾 <dankogai@dan.co.jp> > # To: dankogai@dan.co.jp (小飼=Kogai,弾=Dan) > # Subject: 漢字、カタカナ、ひらがなを含む、非常に長いタイトル行が一体全体どのよ うにしてEncodeされるのか? > # ' > # expected: 'From: 小飼 弾 <dankogai@dan.co.jp> > # To: dankogai@dan.co.jp (小飼=Kogai, 弾=Dan) > # Subject: 漢字、カタカナ、ひらがなを含む、非常に長いタイトル行が一体全体どのよ うにしてEncodeされるのか? > # ' > > and the same for B encoding. > > Reading the RFC section as quoted in the CPAN RT#88717 brings me to > conclusion, that this is Encode's fault. I think the > MIME::Header::decode() should remove spaces separating the encoded- > word from other text or encoded-words. And this feature was removed by > the above mentioned diff hunk. > > What's your opinion?