convert_invalid_entities

Converts invalid Unicode references range to valid range.

Description

(string) convert_invalid_entities( (string) $content ); 

Returns (string)

Converted string.

Parameters (1)

0. $content (string)
String with entities that need converting.

Usage

  1. if ( !function_exists( 'convert_invalid_entities' ) ) { 
  2. require_once ABSPATH . WPINC . '/formatting.php'; 
  3.  
  4. // String with entities that need converting. 
  5. $content = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = convert_invalid_entities($content); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/formatting.php  
  1. function convert_invalid_entities( $content ) { 
  2. $wp_htmltranswinuni = array( 
  3. '€' => '€', // the Euro sign 
  4. '' => '',  
  5. '‚' => '‚', // these are Windows CP1252 specific characters 
  6. 'ƒ' => 'ƒ', // they would look weird on non-Windows browsers 
  7. '„' => '„',  
  8. '…' => '…',  
  9. '†' => '†',  
  10. '‡' => '‡',  
  11. 'ˆ' => 'ˆ',  
  12. '‰' => '‰',  
  13. 'Š' => 'Š',  
  14. '‹' => '‹',  
  15. 'Œ' => 'Œ',  
  16. '' => '',  
  17. 'Ž' => 'Ž',  
  18. '' => '',  
  19. '' => '',  
  20. '‘' => '‘',  
  21. '’' => '’',  
  22. '“' => '“',  
  23. '”' => '”',  
  24. '•' => '•',  
  25. '–' => '–',  
  26. '—' => '—',  
  27. '˜' => '˜',  
  28. '™' => '™',  
  29. 'š' => 'š',  
  30. '›' => '›',  
  31. 'œ' => 'œ',  
  32. '' => '',  
  33. 'ž' => 'ž',  
  34. 'Ÿ' => 'Ÿ' 
  35. ); 
  36.  
  37. if ( strpos( $content, '' ) !== false ) { 
  38. $content = strtr( $content, $wp_htmltranswinuni ); 
  39.  
  40. return $content;