Ranchers, I have a problem trying to serialize an XML file and save it to disk when running the code in
JBoss (4.2.3) but
testing the code in isolation in a normal J2SE application it's serializing fine. The issue is characters such as
Á are saving as glyphs instead of their original UTF-8 encoding. The troublesome
string is:
"KENNETH CHASE/Firearms: A Global History/2003/0521 822742/clearly Chase’s book is much broader. However, there are overlaps between this book and Ágoston’s."
The output xml file, when I run my code in JBoss, produces this:
However when this code is copied and run in a standalone J2SE application using identical utility classes to serialize the data as before I see (correctly):
The full code is rather simple. The first class manually builds out an XML file using the second class's serialize method to bring the xml to an easy to use String. Note: The call to writeStringToXMLFile is embedded in a Stateless entity bean when this is being run in JBoss but basically remains identical to the the call you can see in the main method of xmlWriter.
And the simple class to serialize the document (with some extra - some unused - methods):
Any help would be most appreciated as I've been banging my head for too long on this one!