02-27-2007, 08:00 PM
I have a problem with characters such as the ® reg mark it is making an rss feed invalid. I need to convert them to there code when i submit them to a MySQL database but I am not sure of the best way to do this.
I have tried
$text_art = htmlspecialchars($_POST['text_art']);
But it does not work.
Any pointers ?
02-27-2007, 11:20 PM
Did you try htmlentities() (http://us3.php.net/manual/en/function.htmlentities.php)?
02-28-2007, 01:21 AM
Just tried it and it works for the reg marks but not the trade marks.
Don't see why that would be ?
02-28-2007, 02:38 AM
For the trademark (TM) symbol, in XML you should use &\#8482; (decimal unicode code point) or &\#x2122; (hex). If you have used &\#153; (windows-1252 charset) then it will not work in XML as explained here (http://lachy.id.au/log/2005/10/char-refs).
(Note the red backslashes should be removed. they were inserted to prevent the parsing.)
02-28-2007, 02:59 AM
It being produced by ™
In most cases the problem has arisen because the client has copy and pasted the text from another site (legitimately I should add :))
Oddly after following Fumigator's advice I noted that the tm code wasn't being replaced but I did not check the feed to see if it validates.. I have just checked and in fact it now does.
Thanks again to you both.