I'm simply trying to remove parts of strings, which is usually quite simple with str_replace. The problem is that some of the parts contain swedish characters and PHP just seems to ignore them Example: $string="<font size=4>trÃ¥kig</font>More text. "; $newstring=str_replace("<font size=4>trÃ¥kig</font>", "", $string); Code (markup): Doesn't work. However, $newstring=str_replace("<font size=4>", "", $string); Code (markup): removes the text as it's supposed to. I've tried to: Use å instead. Just replacing "Ã¥" with "a" Use chr(int) Any ideas of how I can replace the "Ã¥"? Should be very simple but something is not working. Thank you.
I've found a solution, even though it's a bit confusing. $newstring=str_replace("<font size=4>tråkig.</font>", "",htmlentities($string)); $newstring=html_entity_decode($newstring); Code (markup):
It wasn't possible since the values where pulled from an external DB. But as I said, the solution above works.