Hi there,

when serializing dom documents using writeToString(), the attribute 'encoding' is set to 'UTF-16' regardless if or to what I set it using setEncoding("foo"). How come and why the heck UTF-16?

$domdocument = $parser->getDocument ();
print "\ndomdocument: encoding is ".$domdocument->getEncoding()."\n";
# prints out ISO-8859-1, which is correct

$writer->setEncoding("ISO-8859-1");
print "\nwriter: encoding is ".$writer->getEncoding()."\n";
# prints out ISO-8859-1, which is correct, too
# if don't use setEncoding(), getEncoding() doesn't return anything, which I think is strange


open(OUTPUT,">prepared.pre") || die "Can't open file for writing: $!";
print OUTPUT $writer->writeToString($domdocument);
close OUTPUT;
# this works, but the encoding is set to UTF-16, which is incorrect

# to correct the encoding issues I have to use the following, which doesn't make me happy
&systemcall("iconv -f ISO-8859-1 -t UTF-16 -o prepared.xml prepared.pre");


Lucas
--
"It's not easy to juggle a pregnant wife and a troubled child, but somehow I managed to fit in eight hours of TV a day."


-Homer Simpson


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to