I have some text saved in database and i want to replace few srtings in it
For example i have text in database:
“Ã–versikt: Hotell Strand Palace Ã¤r belÃ¤get mitt i Londons centrum”
I want to repalce “Ã–versikt” with “Hello” using str_replace but it does not work.
When i echo it shows me: “Översikt: Hotell Strand Palace Ã¤r belÃ¤get mitt i Londons centrum”
It shows me perfect, it should show me like it is being showed but how to using str_replace so that i can replace stings?
any help please?
I am not really answering your question directly, and this may not be practical in your case, but did you know you can use a mysql function REPLACE() to replace strings without having to resort to involving PHP at all.
If you do not use mysql, then I imagine your chosen RDBMS may well have a similar function.
What encoding are you using on the database table, and what’s the default encoding on your page? (5:1 it doesnt match…)
I am using “Collation: latin1_swedish_ci” in mysql database. what should i use on my php and html page?
What does [FPHP]mb_detect_encoding[/FPHP] say your string is encoded in?