Ticket #9201: Better to convert things to UTF-8, to prevent lossy conversion.
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 25 Aug 2010 19:25:52 +0000 (13:25 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 25 Aug 2010 19:36:46 +0000 (13:36 -0600)
framework/Support/lib/Horde/Support/Domhtml.php

index 61b9127..060e58b 100644 (file)
@@ -59,8 +59,8 @@ class Horde_Support_Domhtml
 
         if (!is_null($charset)) {
             if (!$doc->encoding) {
-                $doc->loadHTML(Horde_String::convertCharset($text, $charset, 'ISO-8859-1'));
-                $this->encoding = null;
+                $doc->loadHTML('<?xml encoding="UTF-8">' . Horde_String::convertCharset($text, $charset, 'UTF-8'));
+                $this->encoding = 'UTF-8';
             } elseif ($doc->encoding != $charset) {
                 /* If libxml can't auto-detect encoding, convert to what it
                  * *thinks* the encoding should be. */