Re: Re: ampersand in dom with utf-8

From: Date: Thu, 03 Nov 2005 02:15:35 +0000
Subject: Re: Re: ampersand in dom with utf-8
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-225012@lists.php.net to get a copy of this message
so I decided it would be best just to convert back to the original format so for this string: $string="braised beef shortribs with saut&eacute;ed greens, pearl onions and horseradish cream" I do an html_entity_decode($string); but this still gives me an error when I add it via the DOM functions but render with the è in php. If I look at the xml in firefox on a mac, it looks like this: <name>braised beef shortribs with saut?ed greens, pearl onions and horseradish cream</name> I know that this is a basic question but how could I get this go through? Here is how I'm actually adding via the DOMDocument class:
                        $name->appendChild($dom->createTextNode(html_entity_decode($item_row[slot])));
                        $item->appendChild($name);
Is there any way I could on the client side query the xml string for the encoding to be sure that that in fact is utf-8? The first line of the generated xml is: <?xml version="1.0" encoding="utf-8"?> thanks for any help. -jonathan On Oct 16, 2005, at 1:36 AM, ac wrote:
try this, if you need more entities to be included, just refer to `http://www.w3.org/2003/entities/iso8879/isolat1.ent' or find out its charcode by yourself. <?xml version="1.0"?> <!DOCTYPE html [ <!ENTITY egrave "&#x00e8;"> <!ENTITY icirc "&#x00ee;"> ]> <item_name>farm lettuces with reed avocado, cr&egrave;me fra&icirc;che, radish and cilantro</item_name> On 10/13/05, jonathan <news_php@arclocal.com> wrote:
I'm now getting this error: XML Parsing Error: undefined entity with the following entity at the first ampersand: <item_name>farm lettuces with reed avocado, cr&egrave;me fra&icirc;che, radish and cilantro</item_name> Why is an ampersand considered an undefined entity? The xml version is: <?xml version="1.0"?> Any thoughts please? -jonathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- all born, to be dying -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.general (#225012) next »