dizyn — 2012-12-23T12:16:41-05:00 — #1
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?
cups — 2012-12-23T12:51:47-05:00 — #2
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.
starlion — 2012-12-24T10:09:41-05:00 — #3
What encoding are you using on the database table, and what's the default encoding on your page? (5:1 it doesnt match...)
dizyn — 2013-01-02T01:47:41-05:00 — #4
I am using "Collation: latin1_swedish_ci" in mysql database. what should i use on my php and html page?
starlion — 2013-01-02T07:59:25-05:00 — #5
What does mb_detect_encoding say your string is encoded in?