Skip to content

Commit 5e19401

Browse files
richardbrinkmanRichard Brinkman
andauthored
Fix #120: deprecated HTML-ENTITIES encoding (#121)
Co-authored-by: Richard Brinkman <[email protected]>
1 parent 3f8ee7e commit 5e19401

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/Caxy/HtmlDiff/ListDiffLines.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ public function build()
8484

8585
protected function listByLines(string $old, string $new) : string
8686
{
87-
$new = mb_convert_encoding($new, 'HTML-ENTITIES', "UTF-8");
88-
$old = mb_convert_encoding($old, 'HTML-ENTITIES', "UTF-8");
87+
$new = mb_encode_numericentity($new, [0x80, 0x10FFFF, 0, ~0], 'UTF-8');
88+
$old = mb_encode_numericentity($old, [0x80, 0x10FFFF, 0, ~0], 'UTF-8');
8989

9090
$newDom = new DOMDocument();
9191
$newDom->loadHTML($new);
@@ -401,7 +401,7 @@ private function getInnerHtml(DOMNode $node) : string
401401
private function setInnerHtml(DOMNode $node, string $html) : void
402402
{
403403
$html = sprintf('<%s>%s</%s>', 'body', $html, 'body');
404-
$html = mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8');
404+
$html = mb_encode_numericentity($html, [0x80, 0x10FFFF, 0, ~0], 'UTF-8');
405405

406406
$node->nodeValue = '';
407407

0 commit comments

Comments
 (0)