wpseek.com
Un motore di ricerca WordPress per sviluppatori e autori di temi



_wp_is_valid_utf8_fallback › WordPress Function

Da6.9.0
Deprecaton/a
› _wp_is_valid_utf8_fallback ( $bytes )
Accedi:
  • private
Parametri:
  • (string) $bytes String which might contain text encoded as UTF-8.
    Richiesto: Sì
Vedi:
  • wp_is_valid_utf8()
Ritorna:
  • (bool) Whether the provided bytes can decode as valid UTF-8.
Definito a:
Codex:

Fallback mechanism for safely validating UTF-8 bytes.



Sorgenti

function _wp_is_valid_utf8_fallback( string $bytes ): bool {
	$bytes_length = strlen( $bytes );
	if ( 0 === $bytes_length ) {
		return true;
	}

	$next_byte_at   = 0;
	$invalid_length = 0;

	_wp_scan_utf8( $bytes, $next_byte_at, $invalid_length );

	return $bytes_length === $next_byte_at && 0 === $invalid_length;
}