diff --git a/src/JSLikeHTMLElement.php b/src/JSLikeHTMLElement.php index 2ec11a0..18116a6 100644 --- a/src/JSLikeHTMLElement.php +++ b/src/JSLikeHTMLElement.php @@ -79,14 +79,13 @@ class JSLikeHTMLElement extends \DOMElement } else { // $value is probably ill-formed $f = new \DOMDocument(); - $value = mb_convert_encoding($value, 'HTML-ENTITIES', 'UTF-8'); // Using will generate a warning, but so will bad HTML // (and by this point, bad HTML is what we've got). // We use it (and suppress the warning) because an HTML fragment will // be wrapped around tags which we don't really want to keep. // Note: despite the warning, if loadHTML succeeds it will return true. - $result = $f->loadHTML('' . $value . ''); + $result = $f->loadHTML('' . $value . ''); if ($result) { $import = $f->getElementsByTagName('htmlfragment')->item(0); diff --git a/src/Readability.php b/src/Readability.php index df55a8a..f41d6c0 100644 --- a/src/Readability.php +++ b/src/Readability.php @@ -1426,7 +1426,7 @@ class Readability implements LoggerAwareInterface unset($tidy); } - $this->html = mb_convert_encoding((string) $this->html, 'HTML-ENTITIES', 'UTF-8'); + $this->html = '' . (string) $this->html; if ('html5lib' === $this->parser || 'html5' === $this->parser) { $this->dom = (new HTML5())->loadHTML($this->html);