Je kan geen special char vervangen met str_replace... zover ik weet
gebruik [php]htmlentities[/php] hiervoor, of [php]utf8_encode[/php].
Dat doet ie dus wél
Script:
<?php
$tok = "dit teken is het © copyright";
echo 1 .' '.$tok.'<br/>';
echo 2 .' '.htmlentities($tok).'<br/><br/>';
$tak = str_replace("©","©",$tok);
echo 1 .' '.$tak.'<br/>';
echo 2 .' '.htmlentities($tak).'<br/><br/>';
?>
Uitvoer:
1 dit teken is het © copyright
2
1 dit teken is het © copyright
2 dit teken is het © copyright
Van php.net: htmlentities()
Return Values
Returns the encoded string.
If the input string contains an invalid code unit sequence within the given encoding an empty string will be returned