Re: php5: domDocument source encoding?

From: Date: Mon, 26 Jul 2004 15:01:45 +0000
Subject: Re: php5: domDocument source encoding?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-191886@lists.php.net to get a copy of this message
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

« previous php.general (#191886) next »