public function isUtf8()
    {
        $pattern = array();

        $pattern[] = "[\xC2-\xDF][\x80-\xBF]"; // non-overlong 2-byte
        $pattern[] = "\xE0[\xA0-\xBF][\x80-\xBF]"; // excluding overlongs
        $pattern[] = "[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}"; // straight 3-byte
        $pattern[] = "\xED[\x80-\x9F][\x80-\xBF]"; // excluding surrogates
        $pattern[] = "\xF0[\x90-\xBF][\x80-\xBF]{2}"; // planes 1-3
        $pattern[] = "[\xF1-\xF3][\x80-\xBF]{3}"; // planes 4-15
        $pattern[] = "\xF4[\x80-\x8F][\x80-\xBF]{2}"; // plane 16

        return preg_match("%(?:" . implode("|", $pattern) . ")+%xs", $this->string);
    }
public function isUtf8()
    {
        $pattern = array();

        $pattern[] = "[\xC2-\xDF][\x80-\xBF]"; // non-overlong 2-byte
        $pattern[] = "\xE0[\xA0-\xBF][\x80-\xBF]"; // excluding overlongs
        $pattern[] = "[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}"; // straight 3-byte
        $pattern[] = "\xED[\x80-\x9F][\x80-\xBF]"; // excluding surrogates
        $pattern[] = "\xF0[\x90-\xBF][\x80-\xBF]{2}"; // planes 1-3
        $pattern[] = "[\xF1-\xF3][\x80-\xBF]{3}"; // planes 4-15
        $pattern[] = "\xF4[\x80-\x8F][\x80-\xBF]{2}"; // plane 16

        return preg_match("%(?:" . implode("|", $pattern) . ")+%xs", $this->string);
    }
public function isUtf8 ( ) { $ pattern = array ( ) ; $ pattern [ ] = "[\xC2-\xDF][\x80-\xBF]" ; // non-overlong 2-byte $ pattern [ ] = "\xE0[\xA0-\xBF][\x80-\xBF]" ; // excluding overlongs $ pattern [ ] = "[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}" ; // straight 3-byte $ pattern [ ] = "\xED[\x80-\x9F][\x80-\xBF]" ; // excluding surrogates $ pattern [ ] = "\xF0[\x90-\xBF][\x80-\xBF]{2}" ; // planes 1-3 $ pattern [ ] = "[\xF1-\xF3][\x80-\xBF]{3}" ; // planes 4-15 $ pattern [ ] = "\xF4[\x80-\x8F][\x80-\xBF]{2}" ; // plane 16 return preg_match ( "%(?:" . implode ( "|" , $ pattern ) . ")+%xs" , $ this -> string ) ; }
Returns TRUE if the string is UTF-8 encoded. This method searches for non-ascii multibyte
sequences in the UTF-8 range.

@return boolean
Returns TRUE if the string is UTF - 8 encoded . This method searches for non - ascii multibyte sequences in the UTF - 8 range .