A WordPress-centric search engine for devs and theme authors



_canonical_charset ›

Since3.6.0
Deprecatedn/a
_canonical_charset ( $charset )
Access:
  • private
Parameters:
  • (string) $charset A charset name.
    Required: Yes
See:
Returns:
  • (string) The canonical form of the charset.
Defined at:
Codex:

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



Source

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