Hello,
I have a mysql database with tables / fields charset set to utf8_general_ci. The data of a specific column can hold characters from all over the world, it is set to utf8_general_ci.
Initially I had issues with characters being replaced with ? That was solved by using mysql_set_charset('utf8',$conn);
All characters are displayed correctly on the webpage now.
Now I want to replace all special characters for their "standard" version, by using str_replace() with arrays for the characters to search for and the replace equivalents. This does not work. Question marks in a black box appear.
I found that for, for example for spanish (latin) characters, mysql_set_charset('latin',$conn); solves this issue.
I cannot figure out what is going on, the database is set to utf8, mysql_set_charset() is set to utf8, contents is displayed correctly. Yet to do a str_replace, I have to apparantly change the charset to latin in this case?
As the data can be in any language of the world, how to deal with this? Is there a simple way to make a generic str_replace work. Do I indeed have to set mysql_set_charset() to the respective charset? If so, is there something like a reference list for mysql charsets and countries/languages (all I can find is ISO code languages per country)?
Hope someone can point me in the right direction!
Thanks,