WordPress开发者和主题制作者的搜索引擎



_canonical_charset ›

Since3.6.0
已弃用n/a
_canonical_charset ( $charset )
访问:
  • private
参数:
  • (string) $charset A charset name.
    Required: Yes
查看:
返回:
  • (string) The canonical form of the charset.
定义在:
文档:

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



源码

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