On this page
_canonical_charset( string $charset ): string
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness. Use https://core.trac.wordpress.org/ticket/23688 instead.
Retrieves a canonical form of the provided charset appropriate for passing to PHP functions such as htmlspecialchars() and charset HTML attributes.
Description
See also
Parameters
$charsetstring Required-
A charset name.
Return
string The canonical form of the charset.
Source
File: wp-includes/functions.php. View all references
function _canonical_charset( $charset ) {
if ( 'utf-8' === strtolower( $charset ) || 'utf8' === strtolower( $charset ) ) {
return 'UTF-8';
}
if ( 'iso-8859-1' === strtolower( $charset ) || 'iso8859-1' === strtolower( $charset ) ) {
return 'ISO-8859-1';
}
return $charset;
}
Related
Used By
| Used By | Description |
|---|---|
| _wp_die_process_input() wp-includes/functions.php | Processes arguments passed to wp_die() consistently for its handlers. |
Changelog
| Version | Description |
|---|---|
| 3.6.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/_canonical_charset