Indicates if a given slug for a character set represents the UTF-8 text encoding. If not provided, examines the current blog's charset.
Description
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' ] );
// Without a given charset, it depends on the site option "blog_charset".
$is_utf8 = is_utf8_charset();
Parameters
$blog_charsetstring|nulloptional
Slug representing a text character encoding, or "charset". E.g. "UTF-8", "Windows-1252", "ISO-8859-1", "SJIS". Default value is to infer from "blog_charset" option.Default: null
Return
bool
Whether the slug represents the UTF-8 encoding.
Uses · 2
_is_utf8_charset()Indicates if a given slug for a character set represents the UTF-8 text encoding.
get_option()Retrieves an option value based on an option name.
_canonical_charset()Retrieves a canonical form of the provided charset appropriate for passing to PHP functions such as htmlspecialchars() and charset HTML attributes.
Signature, return type and hooks compared across 5 parsed releases.
6.6.1
A wrapper for _is_utf8_charsetfrom the docblock
6.6.0
Introduced.from the docblock
About this page
Parsed data
Generated from the wordpress-develop 7.0.4 tag, from src/wp-includes/functions.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.