neaj has asked for the wisdom of the Perl Monks concerning the following question:
hello,
i am downloading email with perl from a pop server. until now I haven't had any problems being able to read subject lines, that is to say I can read the letters and numbers and so forth, even though sometimes subjects are complete gibberish.
anyhow, i've been getting several emails that contain what I believe is a UTF16 string embeded in the subject header.
as it appears on the webmail's (hotmail) view source:
(all on one line)Subject: username, A Ne=?UTF-16?B?dwAgAEMAcgBlAGQAaQB0ACAAQwBhAHIAZAAg +AEMAbwB1AGwAZAAgAEIAZQAgAEgAZQBhAGQAZQBkACAAWQBvAHUAcgAgAFcAYQB5AA==? +=
which is also exactly how the data looks like when downloaded via pop
when viewing that specific email in a browser on hotmail, the "A Ne*string*" appears as:
A New Credit Card Could Be Headed Your Way
now I just can't figure out for the life of me how I'm supposed to decode that string. I'll use regex to grab the ?UTF part and then decode it:
print decode( "UTF-16be", $string ), "\n";but all that returns is a bunch of non english (japanese i think) characters and symbols
what is the proper way to decode that string so as i could actually read out the proper subject?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: decoding a UTF-16B string found in an email subject
by Your Mother (Archbishop) on Oct 30, 2013 at 19:07 UTC | |
by Laurent_R (Canon) on Oct 30, 2013 at 20:01 UTC | |
by neaj (Initiate) on Oct 30, 2013 at 19:27 UTC | |
by Your Mother (Archbishop) on Oct 30, 2013 at 20:12 UTC | |
Re: decoding a UTF-16B string found in an email subject
by skx (Parson) on Oct 30, 2013 at 19:24 UTC | |
by runrig (Abbot) on Oct 30, 2013 at 20:18 UTC | |
by Anonymous Monk on Mar 18, 2014 at 12:53 UTC | |
by neaj (Initiate) on Oct 30, 2013 at 20:22 UTC | |
by runrig (Abbot) on Oct 30, 2013 at 20:32 UTC |