I had the same problems and now I noticed that loadHTML () no longer accepts 2 parameters, so I had to find another solution. Using the following function in my DOM library, I was able to remove funky characters from my HTML content.
private static function load_html($html) { $doc = new DOMDocument; $doc->loadHTML('<?xml encoding="UTF-8">' . $html); foreach ($doc->childNodes as $node) if ($node->nodeType == XML_PI_NODE) $doc->removeChild($node); $doc->encoding = 'UTF-8'; return $doc; }
source share