_is_utf8_charset()
Indicates if a given slug for a character set represents the UTF-8 text encoding.
A charset is considered to represent UTF-8 if it is a case-insensitive match of "UTF-8" with or without the hyphen.
Example:
true === _is_utf8_charset( 'UTF-8' ); true === _is_utf8_charset( 'utf8' ); false === _is_utf8_charset( 'latin1' ); false === _is_utf8_charset( 'UTF 8' );
// Only strings match. false === _is_utf8_charset( [ 'charset' => 'utf-8' ] );
is_utf8_charset should be used outside of this file.
Внутренняя функция — эта функция рассчитана на использование самим ядром. Не рекомендуется использовать эту функцию в своем коде.
Хуков нет.
Возвращает
true|false. Whether the slug represents the UTF-8 encoding.
Использование
_is_utf8_charset( $charset_slug );
- $charset_slug(строка) (обязательный)
- Slug representing a text character encoding, or "charset". E.g. "UTF-8", "Windows-1252", "ISO-8859-1", "SJIS".
Список изменений
| С версии 6.6.1 | Введена. |
Код _is_utf8_charset() is utf8 charset WP 6.8.3
function _is_utf8_charset( $charset_slug ) {
if ( ! is_string( $charset_slug ) ) {
return false;
}
return (
0 === strcasecmp( 'UTF-8', $charset_slug ) ||
0 === strcasecmp( 'UTF8', $charset_slug )
);
}