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


Odd warning about iconv() function

我在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来解析电子邮件。我在谷歌上搜索了这个错误,但没有任何结果。有人知道我该如何处理或是否需要处理这个问题吗?

您说您正在使用PlancakeEmailParser.php类。

只需搜索到行:-

$bodyCopy = $body; 

并更改为:-

$bodyCopy = quoted_printable_decode($body);