Merge pull request #11476 from eileenmcnaughton/report
[civicrm-core.git] / CRM / Utils / String.php
index 17aed7f626f130377de2de0fc4c397e227d3bfbf..9b0fdcbf07b64338e458aba4e986f0423bdec7f9 100644 (file)
@@ -47,7 +47,7 @@ class CRM_Utils_String {
   /**
    * Convert a display name into a potential variable name.
    *
-   * @param $title title of the string
+   * @param string $title title of the string
    * @param int $maxLength
    *
    * @return string
@@ -657,13 +657,13 @@ class CRM_Utils_String {
    * @return string
    */
   public static function ellipsify($string, $maxLen) {
-    $len = strlen($string);
+    $len = mb_strlen($string, 'UTF-8');
     if ($len <= $maxLen) {
       return $string;
     }
     else {
       $end = $maxLen - 3;
-      while (strlen($string) > $maxLen - 3) {
+      while (mb_strlen($string, 'UTF-8') > $maxLen - 3) {
         $string = mb_substr($string, 0, $end, 'UTF-8');
         $end = $end - 1;
       }