Correctly identify charset of HTML data
authorMichael M Slusarz <slusarz@curecanti.org>
Tue, 7 Jul 2009 19:57:42 +0000 (13:57 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Tue, 7 Jul 2009 19:57:42 +0000 (13:57 -0600)
framework/Mime/lib/Horde/Mime/Viewer/Html.php

index a2b66dc..1da54af 100644 (file)
@@ -73,10 +73,12 @@ class Horde_Mime_Viewer_html extends Horde_Mime_Viewer_Driver
      *
      * @param string $data     The HTML data.
      * @param boolean $inline  Are we viewing inline?
+     * @param string $charset  The charset of $data (if different than the
+     *                         base part charset).
      *
      * @return array  Two elements: 'html' and 'status'.
      */
-    protected function _cleanHTML($data, $inline)
+    protected function _cleanHTML($data, $inline, $charset = null)
     {
         global $browser;
 
@@ -115,7 +117,7 @@ class Horde_Mime_Viewer_html extends Horde_Mime_Viewer_Driver
 
         $data = Horde_Text_Filter::filter($data, array('cleanhtml', 'xss'), array(
             array(
-                'charset' => $this->_mimepart->getCharset()
+                'charset' => is_null($charset) ? $this->_mimepart->getCharset() : $charset
             ),
             array(
                 'body_only' => $inline,