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?