You are viewing a plain text version of this content. The canonical link for it is here.
Posted to p-dev@xerces.apache.org by Lucas Mbiwe <le...@gmx.net> on 2003/03/11 14:12:57 UTC
[DOMWriter] setEncoding
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: xerces-p-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-p-dev-help@xml.apache.org