如何从imap_fetchbody解析日语字符(utf8?)?

时间:2012-11-15 22:57:56

标签: php utf-8 imap

我在电子邮件中提取了一封包含英文,中文和日文的电子邮件。 我使用PHP / EZComponents来做这件事,但某个日本字符只是没有通过所以我转换到php imap_ * funcs看它们是否会起作用。

这就是我下面的内容,以及我得到的输出。我需要以某种方式对此进行解码...我知道这一切都很好(阅读:过度/混乱)记录在整个网络上,但我现在没有时间在这里获得PHD。非常感谢任何帮助。

$hn='{imap.gmail.com:993/imap/ssl}INBOX';
$inbox = imap_open($hn,$username,$password,CL_EXPUNGE);

foreach($emails as $email_number) {
        $ov = imap_fetch_overview($inbox,$email_number,0);
        $msg = imap_fetchbody($inbox,$email_number,2);
       var_dump($msg);

  // doesnt work... .. but right idea?
  // var_dump( utf8_decode($msg) ); 

}

PARTIAL OUTPUT:

<font face=3D"Arial"><span lang=3D"EN-US" style=3D"font-size:10.5pt"><br></=
span></font><font color=3D"navy" face=3D"MS Gothic"><span lang=3D"JA" style=
=3D"font-size:10.5pt">=CC=EC=9A=DD=A4=AC=A4=A4=A4=A4=A4=AB=A4=E9=A1=A2</spa=
n></font></p><p style=3D"margin-right:0pt;margin-bottom:12pt;margin-left:0p=
t">




<font color=3D"navy" face=3D"MS Gothic"><span lang=3D"JA" style=3D"font-siz=
e:10.5pt"><br></span></font></p><p style=3D"margin-right:0pt;margin-bottom:=
12pt;margin-left:0pt"><font color=3D"navy" face=3D"MS Gothic"><span lang=3D=
"JA" style=3D"font-size:10.5pt">xxend</span></font></p>

0 个答案:

没有答案