My main problem is that some output is coming on the page with a space character written as "
". I want to replace it back with a space. I tried str_replace(" "," ",$mystr)
and even preg_replace("/( )/", " ", $mystr)
but to no avail. How do I do this? And more generally, if there are other html codes coming as output, like "&"
, is there a way to replace them with the actual character output instead of the html code?
Edit: Let me clarify a few things here: I don't want people to enter " < s c r i p t > " tags in the source of an editable page. To prevent that, we need some mechanism to escape special characters. But the problem is that some valid characters are also escaped. I want to unescape them, but also want to make sure that no security is breached.