Re: ampersand in dom with utf-8

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



seems that `DomDocument->createTextNode()' accepts only utf-8 string,
try encode the text before pass it to that function.

in browser side, you can view document property,
browser generally allow you to specify any encoding used to view a
page, try get familar with you browser first.

On 11/3/05, jonathan <news_php@xxxxxxxxxxxx> wrote:
> 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@xxxxxxxxxxxx> 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
> >
> >
> >
> >
>
>


--
all born, to be dying

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux