Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Colin McGuigan
December 6, 2004, 1:19 am
rate this thread
Longer: I search for and process XML files from elsewhere, and need to
transform them with some XSLTs. No problem. Using PHP5 and the DOM
library, everything's a snap. Worked fine, up till now. Today, funky
characters were in the XML file -- "smart" quotes from Word, it looks
like. Anyways, DOMDocument->load complained about them, saying that
they weren't UTF-8, and to specify the encoding.
Lo and behold, the encoding is not specified in these XML files. If I
add in 'encoding="iso-8859-1"' to the header, it works fine. The rub is
I have no control over these XML files.
Reading the file into a string, modifying its header and writing it back
out to another location seems to be my only option, but I'd prefer to do
it without having to use temporary copies of the XML files at all. Is
there any way to simply tell the parser to parse them as if they were