wpseek.com
Uma área de pesquisa sobre o WordPress para devs e autores do tema



_wp_is_valid_utf8_fallback › WordPress Function

Desde6.9.0
Obsoleton/a
› _wp_is_valid_utf8_fallback ( $bytes )
Acesso:
  • private
Parâmetros:
  • (string) $bytes String which might contain text encoded as UTF-8.
    Required: Yes
Ver:
  • wp_is_valid_utf8()
Retorna:
  • (bool) Whether the provided bytes can decode as valid UTF-8.
Definido em:
Codex:

Fallback mechanism for safely validating UTF-8 bytes.



Fonte

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;
}