有关iconv()函数的奇怪警告

时间:2015-03-22 12:59:54

标签: php iconv

我在mylog文件中收到以下警告:

PHP Warning:  iconv(): Charset parameter exceeds the maximum allowed length of 64 characters in /home/jnj/PlancakeEmailParser.php on line 283

有问题的块(getBody()函数的一部分):

if (!$detectedContentType)
    {
        // if here, we missed the text/plain content-type (probably it was
        // in the header), thus we assume the whole body is what we are after
        $body = implode("\n", $this->rawBodyLines);
    }

    // removing trailing new lines
    $body = preg_replace('/((\r?\n)*)$/', '', $body);

    if ($contentTransferEncoding == 'base64')
        $body = base64_decode($body);
    else if ($contentTransferEncoding == 'quoted-printable')
        $body = quoted_printable_decode($body);        

    if($charset != 'UTF-8') {
        // FORMAT=FLOWED, despite being popular in emails, it is not
        // supported by iconv
        $charset = str_replace("FORMAT=FLOWED", "", $charset);

        $bodyCopy = $body; 
        $body = iconv($charset, 'UTF-8//TRANSLIT', $body);

        if ($body === FALSE) { // iconv returns FALSE on failure
            $body = utf8_encode($bodyCopy);
        }
    }

    return $body;
}

我正在使用PlancakeEmailParser.php来解析电子邮件。我用Google搜索了错误,没有任何内容突然出现在我面前。任何人都有任何想法,如何或如果我需要处理这个?

1 个答案:

答案 0 :(得分:0)

你说你使用的是PlancakeEmailParser.php类。

只搜索一行: -

$bodyCopy = $body; 

并改为: -

$bodyCopy = quoted_printable_decode($body);