Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re^2: Mime::Parser utf-8 issue

by mhearse (Chaplain)
on Jun 12, 2009 at 19:02 UTC ( #771063=note: print w/ replies, xml ) Need Help??

in reply to Re: Mime::Parser utf-8 issue
in thread Mime::Parser utf-8 issue

Thanks for you reply. It works great. I have only one small problem. When running the proceeding code, I end up with some trash at the beginning of the subject. Such as: ת\xB7\xA2. Any suggestions?

my $entity = $parser->parse_data($message) or die $!; my $header = $entity->head() or die $!; my $utf8 = decode('MIME-Header', $header); $header = encode('MIME-Header', $utf8);

Comment on Re^2: Mime::Parser utf-8 issue
Select or Download Code
Replies are listed 'Best First'.
Re^3: Mime::Parser utf-8 issue
by blahblahblah (Priest) on Jun 17, 2009 at 00:42 UTC
    Hmmm... I'm not sure. This code works for me, with the header value from your original post.
    use Encode; my $header = '=?UTF8?B?5LuO5Y2a5a6i5paH56ug5Lit5p+l5om+5oKo5oSf5YW06La +j55qE5Li7?==?UTF-8?B?6aKY?='; my $utf8 = decode('MIME-Header', $header); print "uft8: $utf8\n";
    output is:
    uft8: 从博客文章中查找您感兴趣的主题

    Of course, I can't read any Chinese, so I have no idea if those are the right characters or just gibberish.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2015-10-07 04:26 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (170 votes), past polls