Skip Menu |
 

This queue is for tickets about the Encode CPAN distribution.

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

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

Bug Information
Severity: Unimportant
Broken in: 2.39
Fixed in: (no value)



Subject: MIME header encodings handle trailing newlines inconsistently
Download (untitled) / with headers
text/plain 1.4k
This is not a bug but an inconsistency of feature between ISO_2022_JP and other variants of MIME-Header encodings. MIME-(B|Q|Header) eat trailing newlines of string to be encode()'ed. On the other hand, MIME-Header-ISO_2022_JP seems to shorten trailing newlines. I checked Encode 2.39 with Perl 5.12.3. Earlier versions might be able to reproduce this behavior. Test code: ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- use utf8; use Encode::MIME::Header; use Encode qw(encode); my $str = "Subject: ……以後、コードを書くことは野蛮である\n\n"; foreach (qw(UTF-8 MIME-B MIME-Q MIME-Header-ISO_2022_JP)) { print "<".encode($_, $str).">\n"; } ---- >8 ---- >8 ---- >8 ---- >8 ---- >8 ---- >8 ---- >8 ---- >8 ---- >8 ---- Result: ============================================================================ <Subject: ……以後、コードを書くことは野蛮である Show quoted text
>
<Subject: =?UTF-8?B?IOKApuKApuS7peW+jOOAgeOCs+ODvOODieOCkuabuOOBj+OBk+OBqOOBr+mHjg==?= =?UTF-8?B?6Juu44Gn44GC44KL?=> <Subject: =?UTF-8?Q?=20=E2=80=A6=E2=80=A6=E4=BB=A5=E5=BE=8C=E3=80=81=E3=82=B3?= =?UTF-8?Q?=E3=83=BC=E3=83=89=E3=82=92=E6=9B=B8=E3=81=8F=E3=81=93=E3=81=A8?= =?UTF-8?Q?=E3=81=AF=E9=87=8E=E8=9B=AE=E3=81=A7=E3=81=82=E3=82=8B?=> <Subject: =?ISO-2022-JP?B?GyRCIUQhRDBKOGUhIiUzITwlSSRyPXEkLyQzJEgkT0xuGyhC?= =?ISO-2022-JP?B?GyRCSFokRyQiJGsbKEI=?= Show quoted text
>
============================================================================ Thanks.
Download (untitled) / with headers
text/plain 1.6k
cf. https://rt.cpan.org/Ticket/Display.html?id=88717 On Tue May 31 21:01:21 2011, NEZUMI wrote: Show quoted text
> This is not a bug but an inconsistency of feature between ISO_2022_JP > and other variants of MIME-Header encodings. > > MIME-(B|Q|Header) eat trailing newlines of string to be encode()'ed. > On the other hand, MIME-Header-ISO_2022_JP seems to shorten trailing > newlines. > > I checked Encode 2.39 with Perl 5.12.3. Earlier versions might be > able > to reproduce this behavior. > > Test code: > ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- > 8< ---- > use utf8; > use Encode::MIME::Header; > use Encode qw(encode); > > my $str = "Subject: ……以後、コードを書くことは野蛮である\n\n"; > foreach (qw(UTF-8 MIME-B MIME-Q MIME-Header-ISO_2022_JP)) { > print "<".encode($_, $str).">\n"; > } > ---- >8 ---- >8 ---- >8 ---- >8 ---- >8 ---- >8 ---- >8 ---- >8 ----
> >8 ----
> > Result: > ============================================================================ > <Subject: ……以後、コードを書くことは野蛮である >
> >
> <Subject: > =?UTF- > 8?B?IOKApuKApuS7peW+jOOAgeOCs+ODvOODieOCkuabuOOBj+OBk+OBqOOBr+mHjg==?= > =?UTF-8?B?6Juu44Gn44GC44KL?=> > <Subject: > =?UTF-8?Q?=20=E2=80=A6=E2=80=A6=E4=BB=A5=E5=BE=8C=E3=80=81=E3=82=B3?= > =?UTF- > 8?Q?=E3=83=BC=E3=83=89=E3=82=92=E6=9B=B8=E3=81=8F=E3=81=93=E3=81=A8?= > =?UTF-8?Q?=E3=81=AF=E9=87=8E=E8=9B=AE=E3=81=A7=E3=81=82=E3=82=8B?=> > <Subject: =?ISO-2022- > JP?B?GyRCIUQhRDBKOGUhIiUzITwlSSRyPXEkLyQzJEgkT0xuGyhC?= > =?ISO-2022-JP?B?GyRCSFokRyQiJGsbKEI=?=
> >
> ============================================================================ > > Thanks.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.