【问题标题】:Zend Mail Storage encoding polish charsZend Mail Storage 编码波兰字符
【发布时间】:2013-04-20 13:44:43
【问题描述】:

我想使用 Zend_Mail_Storage_Imap 从 imap 获取电子邮件。当我获得内容时,我看不到波兰语字符。 邮件:

coś tam coś 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());
    }
}

【问题讨论】:

    标签: encoding zend-mail polish


    【解决方案1】:

    quoted_printable_decode($string)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-02-05
      • 2013-10-10
      • 1970-01-01
      • 2017-05-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多