Skip Menu |
 

This queue is for tickets about the Encode CPAN distribution.

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

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

Bug Information
Severity: Wishlist
Broken in: 0.93
Fixed in: (no value)



Subject: MIME-Header-ISO_2022_JP does not support decode()
Download (untitled) / with headers
text/plain 292b
Hi MIME-Header-ISO_2022_JP does not support decode() is by design or something? Encode::decode('MIME-Header-ISO_2022_JP', '=?ISO-2022-JP?B? GyRCJEAkcxsoQg==?='); # => croaked "MIME "B" unsupported" This patch for the MIME-Header-ISO_2022_JP to be able to decode(). Regards -- Tomita
Subject: decode-iso2022jp.patch
diff --git a/lib/Encode/MIME/Header/ISO_2022_JP.pm b/lib/Encode/MIME/Header/ISO_2022_JP.pm index 4abfbd0..a27ba7e 100644 --- a/lib/Encode/MIME/Header/ISO_2022_JP.pm +++ b/lib/Encode/MIME/Header/ISO_2022_JP.pm @@ -6,7 +6,7 @@ use warnings; use base qw(Encode::MIME::Header); $Encode::Encoding{'MIME-Header-ISO_2022_JP'} = - bless { encode => 'B', bpl => 76, Name => 'MIME-Header-ISO_2022_JP' } => + bless { decode_b => 1, decode_q => 1, encode => 'B', bpl => 76, Name => 'MIME-Header-ISO_2022_JP' } => __PACKAGE__; use constant HEAD => '=?ISO-2022-JP?B?'; diff --git a/t/mime_header_iso2022jp.t b/t/mime_header_iso2022jp.t index 818443a..4bfe444 100644 --- a/t/mime_header_iso2022jp.t +++ b/t/mime_header_iso2022jp.t @@ -43,6 +43,9 @@ for my $decoded (sort keys %mime){ is(encode('euc-jp', $utf8), $decoded); is($header, $encoded); + + $utf8 = Encode::decode('MIME-Header-ISO_2022_JP', $header); + is(encode('euc-jp', $utf8), $decoded, "decode('MIME-Header-ISO_2022_JP', ...)"); } __END__
Download (untitled) / with headers
text/plain 861b
by design. decode 'MIME-Header', $mime_iso_2022_jp; work fine as explained in perldoc Encode::MIME::Header DESCRIPTION When you decode(=?encoding?X?ENCODED WORD?=), ENCODED WORD is extracted and decoded for X encoding (B for Base64, Q for Quoted-Printable). Then the decoded chunk is fed to decode(encoding). So long as encoding is supported by Encode, any source encoding is fine. That's why 'MIME-Header-ISO_2022_JP' only encodes. Dan the Encode Maintainer On Wed Dec 22 21:43:14 2010, TOMITA wrote: Show quoted text
> Hi > > MIME-Header-ISO_2022_JP does not support decode() is by design or > something? > > Encode::decode('MIME-Header-ISO_2022_JP', '=?ISO-2022-JP?B? > GyRCJEAkcxsoQg==?='); > # => croaked "MIME "B" unsupported" > > This patch for the MIME-Header-ISO_2022_JP to be able to decode(). > > Regards > > -- Tomita


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.