Re: php5: domDocument source encoding?
| From: | Andreas Goetz | Date: | Mon, 26 Jul 2004 15:18:48 +0000 |
| Subject: | Re: php5: domDocument source encoding? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-191888@lists.php.net to get a copy of this message | ||
Excellent, thank you. So I should read the document, the do a $doc->encoding
= 'ISO-8859-1' before reading any nodedata values to obtain ISO characters?!
As documentation hasn't caught up with $doc->encoding, how could I've found
out myself?
Thanks again for the quick help,
Andreas
"Christian Stocker" <chregu@gmail.com> wrote in message
news:49373ab7040726080141034d5c@mail.gmail.com...
> Hi
>
> On Mon, 26 Jul 2004 16:31:38 +0200, Andreas Goetz <cpuidle@gmx.de> wrote:
> > I'm confused and google couldn't answer :(
> >
> > I'm parsing XML files using domDocument and XPath in php5. Works like a
> > charm. But- how do I know if I need to apply and utf8decode to the data
> > returned from the domDocument? Unlike xml_parser_create the domDocument
does
> > not seem to offer an parameter for source encoding.
>
> if you're using ->save or saveXML() it should use the initial encoding
> (and state that in the <?xml header). Otherwise (eg.
> $element->nodeValue) it's always utf-8. You can also read and write
> the attribute $doc->encoding to change the output encoding (or to read
> the input encoding).
>
> But as a general rule. Except for the load (where it uses the value in
> the <?xml header) and save methods , it's always UTF-8.
>
> chregu
>
> > Any ideas?
> >
> > Thanks a lot,
> > Andi
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> --
> christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich
> phone +41 1 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71
> http://www.bitflux.ch | chregu@bitflux.ch | gnupg-keyid
> 0x5CE1DECB