This should be the correct answer, but I don't think the string is correctly encoded. This: use Encode qw(decode);
my $str = 'username, A Ne=?UTF-16?B?dwAgAEMAcgBlAGQAaQB0ACAAQwBhAHIAZA
+AgAEMAbwB1AGwAZAAgAEIAZQAgAEgAZQBhAGQAZQBkACAAWQBvAHUAcgAgAFcAYQB5AA=
+=?=';
my $chr = decode('MIME-Header', $str);
print "$chr\n";
Gets me:UTF-16:Unrecognised BOM 7700 at /.../Encode/MIME/Header.pm line 81.
While this:use MIME::Base64;
my $cstr = 'dwAgAEMAcgBlAGQAaQB0ACAAQwBhAHIAZAAgAEMAbwB1AGwAZAAgAEIAZQ
+AgAEgAZQBhAGQAZQBkACAAWQBvAHUAcgAgAFcAYQB5AA';
my $chk = decode_base64($cstr);
print "$chk\n";
Gets me:w Credit Card Could Be Headed Your Way
So the part that is supposed to be UTF-16 appears to be just base64 encoded.
UPDATE: And if you change 'UTF-16' in the first part to 'UTF-8', then it is correctly decoded without error. |