diff --git a/administrator/components/com_finder/helpers/indexer/parser/html.php b/administrator/components/com_finder/helpers/indexer/parser/html.php index 44dc4db3d4df3..9058089d02181 100644 --- a/administrator/components/com_finder/helpers/indexer/parser/html.php +++ b/administrator/components/com_finder/helpers/indexer/parser/html.php @@ -9,6 +9,8 @@ defined('_JEXEC') or die; +use Joomla\String\StringHelper; + JLoader::register('FinderIndexerParser', dirname(__DIR__) . '/parser.php'); /** @@ -33,10 +35,24 @@ class FinderIndexerParserHtml extends FinderIndexerParser public function parse($input) { // Strip invalid UTF-8 characters. - $input = iconv("utf-8", "utf-8//IGNORE", $input); + if (!StringHelper::valid($input)) + { + if (function_exists('iconv')) + { + iconv("utf-8", "utf-8//IGNORE", $input); + } + else + { + if (!function_exists('utf8_bad_strip')) + { + require_once JPATH_LIBRARIES . '/vendor/joomla/string/src/phputf8/utils/bad.php'; + } + + $input = utf8_bad_strip($input); + } + } - // Convert