rohitbanerjee Posted May 14, 2012 Share Posted May 14, 2012 Hey guys, So when I put the following line of php on an html page: echo '®'; I get the 'Registered' symbol. How do I turn this off? What is happening is that it is part of a longer string that represents an url and the URL is not rendering correctly due to the special character. Thanks Link to comment https://forums.phpfreaks.com/topic/262525-suppress-html-parsing-of-special-characters/ Share on other sites More sharing options...
mrMarcus Posted May 14, 2012 Share Posted May 14, 2012 Try htmlspecialchars Link to comment https://forums.phpfreaks.com/topic/262525-suppress-html-parsing-of-special-characters/#findComment-1345400 Share on other sites More sharing options...
ManiacDan Posted May 14, 2012 Share Posted May 14, 2012 If it really represents a url, try urlencode Link to comment https://forums.phpfreaks.com/topic/262525-suppress-html-parsing-of-special-characters/#findComment-1345401 Share on other sites More sharing options...
rohitbanerjee Posted May 14, 2012 Author Share Posted May 14, 2012 htmlspecialchars() worked -- thanks guys Link to comment https://forums.phpfreaks.com/topic/262525-suppress-html-parsing-of-special-characters/#findComment-1345403 Share on other sites More sharing options...
mrMarcus Posted May 14, 2012 Share Posted May 14, 2012 I must admit, I didn't read your entire post. As ManiacDan said, use urlencode for URL's. And while htmlspecialchars() will work, it could break URL's in other instances and is not ideal for URL's. Straight text, yes, htmlspecialchars() is the choice (of most). Link to comment https://forums.phpfreaks.com/topic/262525-suppress-html-parsing-of-special-characters/#findComment-1345404 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.