Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: decoding a UTF-16B string found in an email subject

by neaj (Initiate)
on Oct 30, 2013 at 20:22 UTC ( [id://1060439]=note: print w/replies, xml ) Need Help??


in reply to Re: decoding a UTF-16B string found in an email subject
in thread decoding a UTF-16B string found in an email subject

thanks the doc for Encode::Mime::Header explained what i was doing wrong

#my $string = "=?UTF-16?B?dwAgAEMAcgBlAGQAaQB0ACAAQwBhAHIAZAAgAEMAbwB1 +AGwAZAAgAEIAZQAgAEgAZQBhAGQAZQBkACAAWQBvAHUAcgAgAFcAYQB5AA==?="; my $string = "dwAgAEMAcgBlAGQAaQB0ACAAQwBhAHIAZAAgAEMAbwB1AGwAZAAgAEIA +ZQAgAEgAZQBhAGQAZQBkACAAWQBvAHUAcgAgAFcAYQB5AA=="; print MIME::Base64::decode( $string ), "\n"; w Credit Card Could Be Headed Your Way

i had to use base64 decoding on the encoded word, and not the whole string

=?encoding?X?ENCODED WORD?=

Replies are listed 'Best First'.
Re^3: decoding a UTF-16B string found in an email subject
by runrig (Abbot) on Oct 30, 2013 at 20:32 UTC
    If you just subsitute 'UTF-16' with 'UTF-8', then the entire line is correctly decoded with decode('MIME-Header', $str). The encoded part appears to be incorrectly encoded. Probably typical of spammers...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1060439]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-25 06:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found