diff --git a/wp-includes/unicode.php b/wp-includes/unicode.php new file mode 100644 index 0000000000..5348e49789 --- /dev/null +++ b/wp-includes/unicode.php @@ -0,0 +1,51 @@ + 'utf-8' ] ); + * + * // Without a given charset, it depends on the site option "blog_charset". + * $is_utf8 = is_utf8_charset(); + * + * @since 6.6.0 + * + * @param ?string $blog_charset Slug representing a text character encoding, or "charset". + * E.g. "UTF-8", "Windows-1252", "ISO-8859-1", "SJIS". + * @return bool Whether the slug represents the UTF-8 encoding. + */ +function is_utf8_charset( $blog_charset = null ) { + $charset_to_examine = $blog_charset ?? get_option( 'blog_charset' ); + + /* + * Only valid string values count: the absence of a charset + * does not imply any charset, let alone UTF-8. + */ + if ( ! is_string( $charset_to_examine ) ) { + return false; + } + + return ( + 0 === strcasecmp( 'UTF-8', $charset_to_examine ) || + 0 === strcasecmp( 'UTF8', $charset_to_examine ) + ); +} diff --git a/wp-includes/version.php b/wp-includes/version.php index 418dcc4f9a..7cfdf0a6d0 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.6-alpha-58147'; +$wp_version = '6.6-alpha-58148'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.