Zend Mail Storage编码波兰语字符

时间:2013-04-26 11:37:31

标签: encoding zend-mail polish

我想使用Zend_Mail_Storage_Imap从imap收到电子邮件。当我得到内容时,我看不到波兰人的角色。 邮件:

  coptamcośtam

使用Zend_Mail_Message的内容:

  

co = B6 tam co = B6 tam

我的代码:

foreach($imap as $messageNum=>$message) 
{
    if($message->isMultipart())
    {
        $con = array(
            'content_type' => null,
            'encoding' => null,
            'text' => null,
        );

        foreach (new RecursiveIteratorIterator($message) as $part) 
        {
            $con['encoding'] = $part->getHeaderField('content-type', 'charset');

            $content_type = strtok($part->contentType, ';');
            if(!$con['content_type']) 
            {
                $con['content_type'] = $content_type;
                $con['text'] = $part->getContent();
            }
            else
            {
                if($content_type == 'text/html')
                {
                    $con['content_type'] = $content_type;
                    $con['text'] = $part->getContent();
                }
            }
        }
        $content = $con['text'];
        if(strtolower($con['encoding']) != 'utf-8')
            $content = iconv($con['encoding'], 'utf-8', $con['text']);
    }
    else
    {
        var_dump($message->getContent());
    }
}

1 个答案:

答案 0 :(得分:0)

quoted_printable_decode($string)