Skip to content

Commit

Permalink
Merge pull request cypht-org#1133 from kambereBr/unicode-domdocument-…
Browse files Browse the repository at this point in the history
…html

[ENH] Improve Unicode Handling in DOMDocument HTML Loading
  • Loading branch information
Shadow243 authored Aug 7, 2024
2 parents a6ea5b6 + 904727e commit 7ee1ef4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion modules/core/message_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 7ee1ef4

Please sign in to comment.