On Mon, 26 Jul 2004 17:18:48 +0200, Andreas Goetz <[EMAIL PROTECTED]> wrote: > 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?!
No, if you access the nodeData with for example ->nodeValue, it's UTF-8, always. $doc->encoding is only honoured during save() or saveXML(). > > As documentation hasn't caught up with $doc->encoding, how could I've found > out myself? reading the source or the W3C Specs ;) chregu > > Thanks again for the quick help, > Andreas > > "Christian Stocker" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > > > Hi > > > > On Mon, 26 Jul 2004 16:31:38 +0200, Andreas Goetz <[EMAIL PROTECTED]> 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 | [EMAIL PROTECTED] | gnupg-keyid 0x5CE1DECB > > -- > 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 | [EMAIL PROTECTED] | gnupg-keyid 0x5CE1DECB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php