Perl Monk, Perl Meditation | |
PerlMonks |
decoding a UTF-16B string found in an email subjectby neaj (Initiate) |
on Oct 30, 2013 at 18:34 UTC ( [id://1060410]=perlquestion: print w/replies, xml ) | Need Help?? |
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) 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?
Back to
Seekers of Perl Wisdom
|
|