From 5fc72b0a51acbff247c4abe5c76581c2f593801d Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Tue, 4 May 2010 12:23:57 -0600 Subject: [PATCH] Convert charset back to original charset --- framework/Text_Filter/lib/Horde/Text/Filter/Html2text.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/framework/Text_Filter/lib/Horde/Text/Filter/Html2text.php b/framework/Text_Filter/lib/Horde/Text/Filter/Html2text.php index 382c0ab7b..9bcddf0f0 100644 --- a/framework/Text_Filter/lib/Horde/Text/Filter/Html2text.php +++ b/framework/Text_Filter/lib/Horde/Text/Filter/Html2text.php @@ -99,15 +99,16 @@ class Horde_Text_Filter_Html2text extends Horde_Text_Filter_Base */ public function postProcess($text) { - $text = Horde_String::convertCharset($text, $this->_params['charset'], 'UTF-8'); - if (extension_loaded('dom')) { + $text = Horde_String::convertCharset($text, $this->_params['charset'], 'UTF-8'); + $old_error = libxml_use_internal_errors(true); $doc = DOMDocument::loadHTML('' . $text); if ($old_error) { libxml_use_internal_errors(false); } - $text = $this->_node($doc, $doc); + + $text = Horde_String::convertCharset($this->_node($doc, $doc), 'UTF-8', $this->_params['charset']); } /* Bring down number of empty lines to 2 max, and remove trailing -- 2.11.0