Merge pull request #23290 from eileenmcnaughton/import_cont
[civicrm-core.git] / CRM / Utils / String.php
index 1acf1d68cda7f4e51f4602185e146792c18b6bd5..82d36093ad77683e2b27848e6987e0789ed30dc8 100644 (file)
@@ -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);
   }
 
   /**