[jdom-interest] illegal character in JDOM

Elliotte Rusty Harold elharo at metalab.unc.edu
Tue Jan 20 09:31:51 PST 2004

At 4:22 PM +0000 1/13/04, Ronny Yip wrote:

I have a problem regarding the encoding of the JDOM.  Is there a way 
to change the encoding to IS0-8859-1 when creating a JDOM document? 
As the string data I am getting from the database may contains 0x1a 

Is the issue output or input? If it's input then you need to properly 
identify the encoding on your data that's used to create the Java 
strings and chars you'll build the Document object from. JDOM has 
little to do with this.

Note that using the Unicode character 0x1A does not require you to 
use ISO 8859-1. That character is available in many different 
character sets and encodings.

A JDOM Document object always uses UTF-16 because that's what Java 
uses. On output you can choose pretty much any encoding Java 
supports. On input you can let Java do the conversion for you using 
an InputStreamReader from whatever encoding the data is actually in.


   Elliotte Rusty Harold
   elharo at metalab.unc.edu
   Effective XML (Addison-Wesley, 2003)

More information about the jdom-interest mailing list