public static function is_utf8($data, $is_strict = true)
	{
		if (! ReflectionTypeHint::isValid()) return false;
		if (is_array($data))
		{
			foreach ($data as $k => &$v)
			{
				if (! self::is_utf8($k, $is_strict) || ! self::is_utf8($v, $is_strict)) return false;
			}
			return true;
		}
		if (is_string($data))
		{
			if (! preg_match('~~suSX', $data)) return false;
			if (function_exists('preg_last_error') && preg_last_error() !== PREG_NO_ERROR) return false;
			#preg_match('~~suSX') much faster (up to 4 times), then mb_check_encoding($data, 'UTF-8')!
			#if (function_exists('mb_check_encoding') && ! mb_check_encoding($data, 'UTF-8')) return false; #DEPRECATED
			if ($is_strict && preg_match('/[^\x09\x0A\x0D\x20-\xBF\xC2-\xF7]/sSX', $data)) return false;
			return true;
		}
		if (is_scalar($data) || is_null($data)) return true;  #~ null, integer, float, boolean
		return false; #object or resource
	}
public static function is_utf8($data, $is_strict = true)
	{
		if (! ReflectionTypeHint::isValid()) return false;
		if (is_array($data))
		{
			foreach ($data as $k => &$v)
			{
				if (! self::is_utf8($k, $is_strict) || ! self::is_utf8($v, $is_strict)) return false;
			}
			return true;
		}
		if (is_string($data))
		{
			if (! preg_match('~~suSX', $data)) return false;
			if (function_exists('preg_last_error') && preg_last_error() !== PREG_NO_ERROR) return false;
			#preg_match('~~suSX') much faster (up to 4 times), then mb_check_encoding($data, 'UTF-8')!
			#if (function_exists('mb_check_encoding') && ! mb_check_encoding($data, 'UTF-8')) return false; #DEPRECATED
			if ($is_strict && preg_match('/[^\x09\x0A\x0D\x20-\xBF\xC2-\xF7]/sSX', $data)) return false;
			return true;
		}
		if (is_scalar($data) || is_null($data)) return true;  #~ null, integer, float, boolean
		return false; #object or resource
	}
public static function is_utf8 ( $ data , $ is_strict = true ) { if ( ! ReflectionTypeHint :: isValid ( ) ) return false ; if ( is_array ( $ data ) ) { foreach ( $ data as $ k => & $ v ) { if ( ! self :: is_utf8 ( $ k , $ is_strict ) || ! self :: is_utf8 ( $ v , $ is_strict ) ) return false ; } return true ; } if ( is_string ( $ data ) ) { if ( ! preg_match ( '~~suSX' , $ data ) ) return false ; if ( function_exists ( 'preg_last_error' ) && preg_last_error ( ) !== PREG_NO_ERROR ) return false ; #preg_match('~~suSX') much faster (up to 4 times), then mb_check_encoding($data, 'UTF-8')!
 #if (function_exists('mb_check_encoding') && ! mb_check_encoding($data, 'UTF-8')) return false; #DEPRECATED
 if ( $ is_strict && preg_match ( '/[^\x09\x0A\x0D\x20-\xBF\xC2-\xF7]/sSX' , $ data ) ) return false ; return true ; } if ( is_scalar ( $ data ) || is_null ( $ data ) ) return true ; #~ null, integer, float, boolean
 return false ; #object or resource
 }
Returns true if data is valid UTF-8 and false otherwise.
For null, integer, float, boolean returns TRUE.

The arrays are traversed recursively, if At least one element of the array
its value is not in UTF-8, returns FALSE.

@link    http://www.w3.org/International/questions/qa-forms-utf-8.html
@link    http://ru3.php.net/mb_detect_encoding
@link    http://webtest.philigon.ru/articles/utf8/
@link    http://unicode.coeurlumiere.com/
@param   array|scalar|null  $data
@param   bool               $is_strict  strict the range of ASCII?
@return  bool
Returns true if data is valid UTF - 8 and false otherwise . For null integer float boolean returns TRUE .