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 Quote 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 Quote 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 Quote 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 Quote 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). Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.