July, 26, 2003 archives
xml handling in php4: solved
so my problem with the xml handling in php4 had a two-step solution: set the encoding on the parser object based on the xml declaration (or utf-8 by default), and set the target encoding so that utf-8 encoding is sent to the character data handler. (thanks to adam for making me take another look at the target encoding thing—i had just assumed it had something to do with outputting xml using the xml extension. i had tried setting the encoding on the parser object before, but that changes both the input and target encodings by default.)
looking at the cvs logs, the misfeature of setting the encoding to iso-8859-1 by default can be worked around in php5 by setting an encoding of ""
, which lets expat behave as the xml specification intended. (default to utf-8, and honor the encoding the xml declaration.)