title: Changing .php to fix excerpt length to allow for Chinese
body: <p>wondering if anyone out there has the quick know how to replace this to allow for the use of the chinese language as chinese is not broken the same way as english is. This is part of a wordpress functions php, im customizing. I have tried several different things with little success.</p>
  
  <pre><code> */
  function cleanead_truncate( $str, $length = 40, $units = 'letters', $ellipsis = '&amp;nbsp;&amp;hellip;' ) {
      if ( $units == 'letters' ) {
          if ( mb_strlen( $str ) &gt; $length ) {
              return mb_substr( $str, 0, $length ) . $ellipsis;
          } else {
              return $str;
          }
      } else {
          $words = explode( ' ', $str );
          if ( count( $words ) &gt; $length ) {
              return implode( " ", array_slice( $words, 0, $length ) ) . $ellipsis;
          } else {
              return $str;
          }
      }
  }
  
  if ( ! function_exists( 'cleanead_excerpt' ) ) {
      function cleanead_excerpt( $limit = 40 ) {
        return cleanead_truncate( get_the_excerpt(), $limit, 'words' );
      }
  }
  
  /**
  </code></pre>
  
  <p>This works well for the English Language, but need it adjusted to allow for chinese text excerpt as well.</p>