Subject: | MIME-Header-ISO_2022_JP does not support decode() |
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__