2009/03/19

Trademark, Copyright, and Register symbols

Trademark, copyright, and register symbols in iso-8895-1 character set cannot be displayed correctly in other character set, for example, urf-8, or even iso-8895-15.

Try this function, which should fix this issue.

function tcr_encode($str) {
   $str = preg_replace("/".chr(153)."/",'™',$str); // trademark
   $str = preg_replace("/".chr(174)."/",'®',$str); // registered tratemark
   $str = preg_replace("/".chr(169)."/",'©',$str); // copyright
   return $str;
}
//change trademark, copyright, and register symbols to html entity
$title = tcr_encode($title);

No comments:

Post a Comment