I understand your annoyance, but I agree with the other posters.
The Xalan-J serializer Javadoc http://xml.apache.org/xalan-j/apidocs/org/apache/xml/serializer/ Serializer.html#setWriter(java.io.Writer) has an explicit warning that the serializer and writer must have consistent encodings. It would probably be beneficial if a similar (or maybe more emphatic) warning were placed in the Javadoc for XMLSerializer(Writer, OutputFormat). However, the problems of representing an XML document as a string (or any sequence of characters) are well known.
XML is not text data, the XML recommendation tells how to convert an XML document into a stream of bytes. If you break that into two steps, document -> characters -> bytes the steps have to be consistent and as Jeremy pointed out there is no effective way for the serializer to detect and adjust itself to the writer's encoding.
The Xerces-J team has no power to change to the Java platform's behavior even if it was a bug. That FileWriter would use the default platform encoding appears to be documented in http://java.sun.com/j2se/1.5.0/docs/api/java/io/FileWriter.html:
The constructors of this class assume that the default character encoding and the default byte-buffer size are acceptable. To specify these values yourself, construct an OutputStreamWriter on a FileOutputStream.
However, unless you have a specific need to serialize to a sequence of characters (for example, to fill in a UI widget), use the forms that take an OutputStream and let the serializer control the entire process.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]