[jdom-interest] encoding problems when using get text

Jason Hunter jhunter at acm.org
Wed Jun 19 13:13:03 PDT 2002


> I've had a hunt round the javadocs as well as the FAQ/Archives but I
> feel like I'm going round in circles!!
> 
> I create a document from a file ( or a string ), and the content of an
> element contains text containing  something like °
> My call to get text on this element returns the unencoded value ( in
> this case a degree symbol ). How can I maintain the original escaped value??

You can't.  SAX doesn't maintain it, so during the build JDOM doesn't
get anything to maintain.  I don't think DOM maintains it either.

In fact this is appropriate and matches Java itself, where for example
you can write characters plain or \uxxxx and it's just an encoding not
retained as content.

> I understand?! the issues with XMLOutputter and setting encoding type
> but I don't see how that applies here.

If you want it encoded on output, you tweak the outputter to do that.

-jh-



More information about the jdom-interest mailing list