WordPress at Your Fingertips
function is not described

_canonical_charset() WP 3.6.0

Retrieve a canonical form of the provided charset appropriate for passing to PHP functions such as htmlspecialchars() and charset HTML attributes.

This is an internal function for using it by WP core itself. It's not recommended to use this function in your code.

No Hooks.

Return

String. The canonical form of the charset.

Usage

_canonical_charset( $charset );
$charset(string) (required)
A charset name.

Notes

Changelog

Since 3.6.0 Introduced.

Code of _canonical_charset() WP 5.8.2

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