From: Michael M Slusarz Date: Fri, 20 Aug 2010 20:31:44 +0000 (-0600) Subject: Bug #9189: Pass charset to Html2text. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=a2e63c9945413bc8d0487ded4a6f505ad6d20386;p=horde.git Bug #9189: Pass charset to Html2text. --- diff --git a/imp/lib/Contents.php b/imp/lib/Contents.php index 1ad5df21c..e3caf1652 100644 --- a/imp/lib/Contents.php +++ b/imp/lib/Contents.php @@ -524,19 +524,27 @@ class IMP_Contents // Retrieve 3x the size of $maxlen of bodytext data. This should // account for any content-encoding & HTML tags. $pmime = $this->getMIMEPart($mimeid, array('length' => $maxlen * 3)); - $ptext = $pmime->getContents(); - $ptext = Horde_String::convertCharset($ptext, $pmime->getCharset()); + $charset = $GLOBALS['registry']->getCharset(); + + $ptext = Horde_String::convertCharset($pmime->getContents(), $pmime->getCharset(), $charset); + if ($pmime->getType() == 'text/html') { - $ptext = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($ptext, 'Html2text'); + $ptext = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($ptext, 'Html2text', array('charset' => $charset)); } $this->_build = $oldbuild; if (Horde_String::length($ptext) > $maxlen) { - return array('cut' => true, 'text' => Horde_String::truncate($ptext, $maxlen)); + return array( + 'cut' => true, + 'text' => Horde_String::truncate($ptext, $maxlen) + ); } - return array('cut' => false, 'text' => $ptext); + return array( + 'cut' => false, + 'text' => $ptext + ); } /**