Skip to content

Commit 44219ce

Browse files
authored
Merge pull request #46 from catalyst/fix-encoding
fix: Fix encoding change from 4.5 compat changes
2 parents dd7d044 + 3841574 commit 44219ce

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

classes/text_filter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ public function filter($text, array $options = []) {
585585
// Add a wrapping div so DOMDocument doesnt mangle the structure.
586586
$loadtext = '<div>' . $text . '</div>';
587587
// Ensure the encoding can be loaded by the domdoc.
588-
$loadtext = html_entity_decode($loadtext);
588+
$loadtext = mb_encode_numericentity($loadtext, [0xa0, 0xffff, 0, 0xffff], 'UTF-8', true);
589589

590590
// Supress warnings. HTML5 nodes currently throw warnings.
591591
// Use flags to prevent html and body tags from being included.
@@ -618,7 +618,7 @@ public function filter($text, array $options = []) {
618618
// Encase in another div to prevent mangling when loading into the new domdoc.
619619
$newtext = '<div>' . $newtext . '</div>';
620620
// Encode to the domdocument usable format.
621-
$newtext = html_entity_decode($newtext);
621+
$newtext = mb_encode_numericentity($newtext, [0xa0, 0xffff, 0, 0xffff], 'UTF-8', true);
622622

623623
// Open that as a new doc to pull the video node out.
624624
$tempdom = new DOMDocument('1.0', 'UTF-8');
@@ -688,7 +688,7 @@ public function filter($text, array $options = []) {
688688
// Encase in another div to prevent mangling when loading into the new domdoc.
689689
$newtext = '<div>' . $newtext . '</div>';
690690
// Encode to the domdocument usable format.
691-
$newtext = html_entity_decode($newtext);
691+
$newtext = mb_encode_numericentity($newtext, [0xa0, 0xffff, 0, 0xffff], 'UTF-8', true);
692692

693693
// Open that as a new doc to pull the video node out.
694694
$tempdom = new DOMDocument('1.0', 'UTF-8');

0 commit comments

Comments
 (0)