wp_set_internal_encoding()
Sets internal encoding.
In most cases the default internal encoding is latin1, which is of no use, since we want to use the mb_ functions for utf-8 strings.
Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.
No Hooks.
Returns
null. Nothing (null).
Usage
wp_set_internal_encoding();
Changelog
| Since 3.0.0 | Introduced. |
wp_set_internal_encoding() wp set internal encoding code WP 6.9.1
function wp_set_internal_encoding() {
if ( function_exists( 'mb_internal_encoding' ) ) {
$charset = get_option( 'blog_charset' );
// phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
if ( ! $charset || ! @mb_internal_encoding( $charset ) ) {
mb_internal_encoding( 'UTF-8' );
}
}
}