From 5d87e89c81ec84626c92b5d7dea7bcee1255f809 Mon Sep 17 00:00:00 2001 From: Bradley Taylor Date: Sun, 20 Feb 2022 14:30:12 +0000 Subject: [PATCH] Fix call to function_exists in CRM_Utils_String::isUtf8 --- CRM/Utils/String.php | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/CRM/Utils/String.php b/CRM/Utils/String.php index 1acf1d68cd..82d36093ad 100644 --- a/CRM/Utils/String.php +++ b/CRM/Utils/String.php @@ -329,21 +329,8 @@ class CRM_Utils_String { * @return bool */ public static function isUtf8($str) { - if (!function_exists(mb_detect_encoding)) { - // eliminate all white space from the string - $str = preg_replace('/\s+/', '', $str); - - // pattern stolen from the php.net function documentation for - // utf8decode(); - // comment by JF Sebastian, 30-Mar-2005 - return preg_match('/^([\x00-\x7f]|[\xc2-\xdf][\x80-\xbf]|\xe0[\xa0-\xbf][\x80-\xbf]|[\xe1-\xec][\x80-\xbf]{2}|\xed[\x80-\x9f][\x80-\xbf]|[\xee-\xef][\x80-\xbf]{2}|f0[\x90-\xbf][\x80-\xbf]{2}|[\xf1-\xf3][\x80-\xbf]{3}|\xf4[\x80-\x8f][\x80-\xbf]{2})*$/', $str); - // || - // iconv('ISO-8859-1', 'UTF-8', $str); - } - else { - $enc = mb_detect_encoding($str, ['UTF-8'], TRUE); - return ($enc !== FALSE); - } + $enc = mb_detect_encoding($str, ['UTF-8'], TRUE); + return ($enc !== FALSE); } /** -- 2.25.1