In PHP, we can use mb_check_encoding() to determine if a string is valid UTF-8. But that\'s not a portable solution as it requires the mbstring extension to be compiled in a
this works for me for detecting unicode characters, linke emoji or russian or chinese:
private function has_unicode( $string ) { $pattern = '/^.*[^\x{00}-\x{00FF}]+.*$/u'; return preg_match( $pattern, $string ) ? true : false; }