I have a problem when I try to replace special chars like "Ñ" by "N" or "Ç" by "C" or "Ü" by "U" for example in PHP from strings latin1 codified.
I retrieve from mySQL which is UTF-8 codified this string "IBAÑEZ RIBERA, ALBA" and I would like to replace "Ñ" by "N" and get "IBANEZ RIBERA, ALBA", but I have several problems.
If I use str_replace it doesn't work and If I use iconv('UTF-8', 'ISO-8859-1//TRANSLIT//IGNORE', "IBAÑEZ RIBERA, ALBA")
what I get is "IBAEZ RIBERA, ALBA", where this char "Ñ" is removed and not replaced by "N" how I like it.
So, how can I do this replacement?
Edit I:
I have observed that if I replace chars with mySQL functions in mySQL Workbench whit this query:
select id, id_player, name, replace(replace(replace(replace(name, " ", "-"), ",", " "), " ", ""), 'Ñ', 'N') as urlName
from tbl003_player p, (select id_player from tbl006_player_club where id = 188) pc where
p.id = pc.id_player;
I get the result what I want in the field "urlName"!!!
But, when I try to retrieve this data in PHP from the query I've got:
"IBAÑEZ-RIBERA-ALBA"
What happened?