X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=library%2FHTML5%2FParser.php;h=e101d3e545ad5e1f7245fba9be5b5b6c3663de86;hb=146f386e37670b64c588c65d25c9f068a0e8e066;hp=c7faf875ad326304c44f65aa3f64ff63b07924c6;hpb=709022ddee9bc2e9995911e02e40d1b1dd5150b0;p=friendica.git diff --git a/library/HTML5/Parser.php b/library/HTML5/Parser.php index c7faf875ad..e101d3e545 100644 --- a/library/HTML5/Parser.php +++ b/library/HTML5/Parser.php @@ -20,7 +20,12 @@ class HTML5_Parser // Cleanup invalid HTML $doc = new DOMDocument(); - @$doc->loadHTML($text); + + if (mb_detect_encoding($text, "UTF-8", true) == "UTF-8") + @$doc->loadHTML(''.$text); + else + @$doc->loadHTML($text); + $text = $doc->saveHTML(); $tokenizer = new HTML5_Tokenizer($text, $builder);