wp_set_internal_encoding

The timeline below displays how wordpress function wp_set_internal_encoding has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.3

/**
 * 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.
 *
 * @since 3.0.0
 * @access private
 */
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');
        }
    }
}

WordPress Version: 5.3

/**
 * Set 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.
 *
 * @since 3.0.0
 * @access private
 */
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');
        }
    }
}

WordPress Version: 4.0

/**
 * Set 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.
 *
 * @since 3.0.0
 * @access private
 */
function wp_set_internal_encoding()
{
    if (function_exists('mb_internal_encoding')) {
        $charset = get_option('blog_charset');
        if (!$charset || !@mb_internal_encoding($charset)) {
            mb_internal_encoding('UTF-8');
        }
    }
}

WordPress Version: 3.7

/**
 * Sets internal encoding using mb_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.
 *
 * @access private
 * @since 3.0.0
 */
function wp_set_internal_encoding()
{
    if (function_exists('mb_internal_encoding')) {
        $charset = get_option('blog_charset');
        if (!$charset || !@mb_internal_encoding($charset)) {
            mb_internal_encoding('UTF-8');
        }
    }
}