@@ -585,7 +585,7 @@ public function filter($text, array $options = []) {
585
585
// Add a wrapping div so DOMDocument doesnt mangle the structure.
586
586
$ loadtext = '<div> ' . $ text . '</div> ' ;
587
587
// 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 );
589
589
590
590
// Supress warnings. HTML5 nodes currently throw warnings.
591
591
// Use flags to prevent html and body tags from being included.
@@ -618,7 +618,7 @@ public function filter($text, array $options = []) {
618
618
// Encase in another div to prevent mangling when loading into the new domdoc.
619
619
$ newtext = '<div> ' . $ newtext . '</div> ' ;
620
620
// 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 );
622
622
623
623
// Open that as a new doc to pull the video node out.
624
624
$ tempdom = new DOMDocument ('1.0 ' , 'UTF-8 ' );
@@ -688,7 +688,7 @@ public function filter($text, array $options = []) {
688
688
// Encase in another div to prevent mangling when loading into the new domdoc.
689
689
$ newtext = '<div> ' . $ newtext . '</div> ' ;
690
690
// 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 );
692
692
693
693
// Open that as a new doc to pull the video node out.
694
694
$ tempdom = new DOMDocument ('1.0 ' , 'UTF-8 ' );
0 commit comments