• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JBoss character encoding issue (works outside JBoss!)

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
reply
    Bookmark Topic Watch Topic
  • New Topic