Convert charset back to original charset
authorMichael M Slusarz <slusarz@curecanti.org>
Tue, 4 May 2010 18:23:57 +0000 (12:23 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 5 May 2010 16:02:57 +0000 (10:02 -0600)
framework/Text_Filter/lib/Horde/Text/Filter/Html2text.php

index 382c0ab..9bcddf0 100644 (file)
@@ -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('<?xml encoding="UTF-8">' . $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