Skip to content

Commit

Permalink
if function_exist() ...
Browse files Browse the repository at this point in the history
  • Loading branch information
kodejuice committed Jun 12, 2020
1 parent 6f9f896 commit 2ba6c47
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions php/lib/simple_html_dom.php
Original file line number Diff line number Diff line change
Expand Up @@ -1041,7 +1041,11 @@ function convert_text($text)
&& ($this->is_utf8($text))) {
$converted_text = $text;
} else {
$converted_text = iconv($sourceCharset, $targetCharset, $text);
// @kodjuice edit
// Fri 12th June 2020
if (function_exists('iconv')) {
$converted_text = iconv($sourceCharset, $targetCharset, $text);
}
}
}

Expand Down Expand Up @@ -1755,8 +1759,13 @@ protected function parse_charset()
// 'CP1251'/'ISO-8859-5' will be detected as
// 'CP1252'/'ISO-8859-1'. This will cause iconv to fail, in
// which case we can simply assume it is the other charset.
if (!@iconv('CP1252', 'UTF-8', $this->doc)) {
$encoding = 'CP1251';

// @kodejuice edit
// Fri 12th June 2020
if (function_exists('iconv')) {
if (!@iconv('CP1252', 'UTF-8', $this->doc)) {
$encoding = 'CP1251';
}
}
}

Expand Down

0 comments on commit 2ba6c47

Please sign in to comment.