convert_invalid_entities

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

WordPress Version: 6.3

/**
 * Converts invalid Unicode references range to valid range.
 *
 * @since 4.3.0
 *
 * @param string $content String with entities that need converting.
 * @return string Converted string.
 */
function convert_invalid_entities($content)
{
    $wp_htmltranswinuni = array(
        '€' => '€',
        // The Euro sign.
        '' => '',
        '‚' => '‚',
        // These are Windows CP1252 specific characters.
        'ƒ' => 'ƒ',
        // They would look weird on non-Windows browsers.
        '„' => '„',
        '…' => '…',
        '†' => '†',
        '‡' => '‡',
        'ˆ' => 'ˆ',
        '‰' => '‰',
        'Š' => 'Š',
        '‹' => '‹',
        'Œ' => 'Œ',
        '' => '',
        'Ž' => 'Ž',
        '' => '',
        '' => '',
        '‘' => '‘',
        '’' => '’',
        '“' => '“',
        '”' => '”',
        '•' => '•',
        '–' => '–',
        '—' => '—',
        '˜' => '˜',
        '™' => '™',
        'š' => 'š',
        '›' => '›',
        'œ' => 'œ',
        '' => '',
        'ž' => 'ž',
        'Ÿ' => 'Ÿ',
    );
    if (str_contains($content, '&#1')) {
        $content = strtr($content, $wp_htmltranswinuni);
    }
    return $content;
}

WordPress Version: 5.4

/**
 * Converts invalid Unicode references range to valid range.
 *
 * @since 4.3.0
 *
 * @param string $content String with entities that need converting.
 * @return string Converted string.
 */
function convert_invalid_entities($content)
{
    $wp_htmltranswinuni = array(
        '€' => '€',
        // The Euro sign.
        '' => '',
        '‚' => '‚',
        // These are Windows CP1252 specific characters.
        'ƒ' => 'ƒ',
        // They would look weird on non-Windows browsers.
        '„' => '„',
        '…' => '…',
        '†' => '†',
        '‡' => '‡',
        'ˆ' => 'ˆ',
        '‰' => '‰',
        'Š' => 'Š',
        '‹' => '‹',
        'Œ' => 'Œ',
        '' => '',
        'Ž' => 'Ž',
        '' => '',
        '' => '',
        '‘' => '‘',
        '’' => '’',
        '“' => '“',
        '”' => '”',
        '•' => '•',
        '–' => '–',
        '—' => '—',
        '˜' => '˜',
        '™' => '™',
        'š' => 'š',
        '›' => '›',
        'œ' => 'œ',
        '' => '',
        'ž' => 'ž',
        'Ÿ' => 'Ÿ',
    );
    if (strpos($content, '&#1') !== false) {
        $content = strtr($content, $wp_htmltranswinuni);
    }
    return $content;
}

WordPress Version: 4.3

/**
 * Converts invalid Unicode references range to valid range.
 *
 * @since 4.3.0
 *
 * @param string $content String with entities that need converting.
 * @return string Converted string.
 */
function convert_invalid_entities($content)
{
    $wp_htmltranswinuni = array(
        '€' => '€',
        // the Euro sign
        '' => '',
        '‚' => '‚',
        // these are Windows CP1252 specific characters
        'ƒ' => 'ƒ',
        // they would look weird on non-Windows browsers
        '„' => '„',
        '…' => '…',
        '†' => '†',
        '‡' => '‡',
        'ˆ' => 'ˆ',
        '‰' => '‰',
        'Š' => 'Š',
        '‹' => '‹',
        'Œ' => 'Œ',
        '' => '',
        'Ž' => 'Ž',
        '' => '',
        '' => '',
        '‘' => '‘',
        '’' => '’',
        '“' => '“',
        '”' => '”',
        '•' => '•',
        '–' => '–',
        '—' => '—',
        '˜' => '˜',
        '™' => '™',
        'š' => 'š',
        '›' => '›',
        'œ' => 'œ',
        '' => '',
        'ž' => 'ž',
        'Ÿ' => 'Ÿ',
    );
    if (strpos($content, '&#1') !== false) {
        $content = strtr($content, $wp_htmltranswinuni);
    }
    return $content;
}