Skip to content
Snippets Groups Projects

Converting html before creating DOM Document.

Merged Jan Kellermann requested to merge issue/klaro-3483397:3483397-fix-broken-chars into 3.x
1 file
+ 3
1
Compare changes
  • Side-by-side
  • Inline
@@ -597,11 +597,12 @@ class KlaroHelper {
@@ -597,11 +597,12 @@ class KlaroHelper {
}
}
$klaro_apps = $this->getApps();
$klaro_apps = $this->getApps();
$dom = new \DOMDocument();
$complete_html = strpos($html, '<!DOCTYPE') !== FALSE;
$complete_html = strpos($html, '<!DOCTYPE') !== FALSE;
// If "complete html" is supplied use DomDocument to create.
// If "complete html" is supplied use DomDocument to create.
if ($complete_html) {
if ($complete_html) {
$dom = new \DOMDocument();
$dom = new \DOMDocument();
 
$html = mb_encode_numericentity($html, [0x80, 0x10FFFF, 0, 0x1FFFFF], 'UTF-8');
$dom->loadHTML($html, LIBXML_NOERROR | LIBXML_SCHEMA_CREATE);
$dom->loadHTML($html, LIBXML_NOERROR | LIBXML_SCHEMA_CREATE);
}
}
else {
else {
@@ -804,6 +805,7 @@ class KlaroHelper {
@@ -804,6 +805,7 @@ class KlaroHelper {
if ($complete_html) {
if ($complete_html) {
$html = $dom->saveHTML();
$html = $dom->saveHTML();
 
$html = mb_decode_numericentity($html, [0x80, 0x10FFFF, 0, 0x1FFFFF], 'UTF-8');
}
}
else {
else {
$html = Html::serialize($dom);
$html = Html::serialize($dom);
Loading