From 904727e9827baba0bc439c60bbd0c55ef7a2eabb Mon Sep 17 00:00:00 2001 From: kambereBr Date: Thu, 25 Jul 2024 21:58:46 +0200 Subject: [PATCH] [ENH] Improve Unicode Handling in DOMDocument HTML Loading --- modules/core/message_functions.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/core/message_functions.php b/modules/core/message_functions.php index 7873215c9e..8d34ad2bbc 100644 --- a/modules/core/message_functions.php +++ b/modules/core/message_functions.php @@ -449,7 +449,8 @@ class HTMLToText { function __construct($html) { $doc = new DOMDocument(); - $doc->loadHTML(html_entity_decode($html, ENT_QUOTES | ENT_HTML5, 'UTF-8')); + $html = mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8'); + $doc->loadHTML(htmlentities($html, ENT_QUOTES, 'UTF-8')); if (trim($html) && $doc->hasChildNodes()) { $this->parse_nodes($doc->childNodes); }