Problem with str_replace

Hi, I’m trying to use str_replace to replace some German characters with their ASCII equivalents, like so:


$description = str_replace("%ö%", "ö", $description);

And I also tried


$description = str_replace("%ö%", "ö", $description);

I checked in the database and it doesn’t show as the correct character- it shows as ö (and outputs as that)

I need to be able to input / output German characters correctly in my form- I was hoping str_replace would do the job but it seems that it doesn’t.

My pages all have UTF-8 encoding in the header (I’ve heard that sometimes the issue is non-UTF encoding)

Any ideas?

Can you post the SHOW CREATE TABLE for the table in which you’re storing this data?

Not sure I’d do that, but I checked the db and it’s in UTF-8 format (I changed it from Latin- but it’s still not accepting these characters)

I also added this to my db connection include:


mysql_set_charset('utf8'); 

  • and interestingly it now looks ok in the database record, but it still isn’t outputting. I tried changing the output variable as follows, but it didn’t work:

  $description = $row["Description"];
  $descriptionclean = htmlentities($description, ENT_QUOTES);

???