CODE:
{
encode_t *enc = INT2PTR(encode_t *, SvIV(SvRV(obj)));
+ if (SvUTF8(src)) {
+ sv_utf8_downgrade(src, FALSE);
+ }
ST(0) = encode_method(aTHX_ enc, enc->t_utf8, src, check);
SvUTF8_on(ST(0));
XSRETURN(1);
use strict;
#use Test::More qw(no_plan);
-use Test::More tests => 6;
+use Test::More tests => 7;
use_ok("Encode::MIME::Header");
my $eheader =<<'EOS';
Subject: If you can read this you understand the example.
EOS
-is(Encode::decode('MIME-Header', $eheader), $dheader, "decode (RFC2047)");
+is(Encode::decode('MIME-Header', $eheader), $dheader, "decode ASCII (RFC2047)");
use utf8;
+my $uheader =<<'EOS';
+From: =?US-ASCII?Q?Keith_Moore?= <moore@cs.utk.edu>
+To: =?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?= <keld@dkuug.dk>
+CC: =?ISO-8859-1?Q?Andr=E9?= Pirard <PIRARD@vm1.ulg.ac.be>
+Subject: =?ISO-8859-1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?=
+ =?ISO-8859-2?B?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLg==?=
+EOS
+
+is(Encode::decode('MIME-Header', $uheader), $dheader, "decode UTF-8 (RFC2047)");
+
+
$dheader=<<'EOS';
From: 小飼 弾 <dankogai@dan.co.jp>
To: dankogai@dan.co.jp (小飼=Kogai, 弾=Dan)