[jdom-interest] Element.getText and encoding
Ken Rune Helland
kenh at csc.no
Mon Mar 5 07:32:57 PST 2001
At 11:56 AM 3/5/2001 +0100, you wrote:
>Could someone help me out?
>If I would like to get the text of an element, I can use the getText()
>method to get to the text node of that element. Is it possible to influence
>the encoding setting before I use getText().
>I do know that I can use the XMLOutputter class (which has a method
>setEncoding()), but I would find it useful to have similar functionality
>with the method getText().
>Rudolf de Grijs
The text (String objects) inside java is always unicode,
the parser will translate to unicode char's from the encoding
set in the xml document with the encoding attribute in the
xml declaration. The XMLOutputter translates from unicode to the
output encoding set with XMLOutputter.setEncoding().
You can turn a java String ( with 16 bit characters )
into a (8 bit) byte array with a spesific encoding using
More information about the jdom-interest