Posted By

jspicher on 10/09/09


Tagged

php text functions special characters fixcontent mac-characters


Versions (?)

fix_content()


 / Published in: PHP
 

Fix special mac-characters in a string of text.

  1. function fix_content($content = false){
  2. if(!$content) return false;
  3. $badchr = array("\xc2", "\x80", "\x98", "\x99", "\x8c", "\x9d");
  4. $goodchr = array('', '', '\'', '\'', '"', '"');
  5. $content = str_replace($badchr, $goodchr, $content);
  6. $content = str_replace("Õ", "'", $content);
  7. $content = str_replace("Ô", "'", $content);
  8. $content = str_replace("Ñ", "-", $content);
  9. $content = str_replace("Ò", """, $content);
  10. $content = str_replace("Ó", """, $content);
  11. $content = str_replace("â", "", $content);
  12. return $content;}

Report this snippet  

You need to login to post a comment.