Re: Problem with special char in MySQL and XML [message #174838 is a reply to message #174834] |
Wed, 13 July 2011 00:19 |
Denis McMahon
Messages: 634 Registered: September 2010
Karma:
|
Senior Member |
|
|
On Tue, 12 Jul 2011 13:02:54 -0700, Sarah wrote:
> Hi! I've a table UTF8_general_ci where I've symbols like: & è , à ' ...
>
> I've seen that when I try to generate an XML file (that works OK with
> other tables) I show this error:
>
>
> Warning: SimpleXMLElement::addChild() [simplexmlelement.addchild]:
> unterminated entity reference Pizza in /var/www/domain.com/xmlfeed.php
> on line 164
>
> In my PHP code I've something like this:
>
> $aaa->addChild('date', strip_tags(utf8_encode($row{'Date'})) );
> $aaa->addChild('title', strip_tags(utf8_encode($row{'Title'})) );
>
>
> Where is it my error?
Perhaps wrap the data in a call to either htmlentities() or
htmlspecialchars() - you won't need both, I don't know which would be
best for your purpose, but I suspect htmlentities().
Rgds
Denis McMahon
|
|
|