Skip to content

Commit 55b7017

Browse files
author
Zinta
committed
fixing Call to undefined function mb_detect_encoding() error
this happens with minimal php installation ( missing php-mbstring library)
1 parent ec710a0 commit 55b7017

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Src/Sunra/PhpSimple/simplehtmldom_1_5/simple_html_dom.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1245,7 +1245,7 @@ protected function parse_charset()
12451245
if (empty($charset))
12461246
{
12471247
// Have php try to detect the encoding from the text given to us.
1248-
$charset = mb_detect_encoding($this->root->plaintext . "ascii", $encoding_list = array( "UTF-8", "CP1252" ) );
1248+
$charset = (function_exists('mb_detect_encoding')) ? mb_detect_encoding($this->root->plaintext . "ascii", $encoding_list = array( "UTF-8", "CP1252" ) ) : false;
12491249
if (is_object($debugObject)) {$debugObject->debugLog(2, 'mb_detect found: ' . $charset);}
12501250

12511251
// and if this doesn't work... then we need to just wrongheadedly assume it's UTF-8 so that we can move on - cause this will usually give us most of what we need...

0 commit comments

Comments
 (0)