Jeremy Carroll wrote:
Rubbish. It is the documented behaviour. It is well motivated; it enables the Java app to talk with the OS and other apps in the expected encoding.
Windows and Java are both Unicode native systems, yet Java writes Latin-1 by default on Windows. Looks like a bug to me, regardless of how well documented it is (I find no documentation on it anywhere, we worked out this behaviour through trial and error). But regardless, Xerces lets this situation through without throwing warning or error, and here lies the problem.
It just isn't appropriate for WebApps. What is broken is using a FileWriter in code intended for a Web application.
The code is not being used by a web application. It is being used to persist data to disk in a system backend.
A Writer is a mechanism for writing text data (in my case to disk but that's not important). XML is text data. A Writer is a perfectly logical choice to use in this case.
Regards, Graham --
smime.p7s
Description: S/MIME Cryptographic Signature
