Converts invalid Unicode references range to valid range.
Parameters
$content
stringrequired- String with entities that need converting.
Source
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, '' ) ) {
$content = strtr( $content, $wp_htmltranswinuni );
}
return $content;
}
Changelog
Version | Description |
---|---|
4.3.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.