Skip to content

Commit 6fb321e

Browse files
Improved loading of non-UTF-8 strings
1 parent 05414db commit 6fb321e

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

mf2/Parser.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ class Parser {
3737
public function __construct($input, $baseurl = null, $htmlSafe = false) {
3838
// For the moment: assume string = string of HTML
3939
if (is_string($input)) {
40-
if (strtolower(mb_detect_encoding($input)) == 'utf-8') {
41-
$input = mb_convert_encoding($input, 'HTML-ENTITIES', "UTF-8");
42-
}
40+
$input = mb_convert_encoding($input, 'HTML-ENTITIES', mb_detect_encoding($input));
4341

4442
$doc = new DOMDocument();
4543
@$doc->loadHTML($input);

0 commit comments

Comments
 (0)