[jdom-interest] Special Characters and JDOM

Elliotte Rusty Harold elharo at metalab.unc.edu
Wed Jul 26 06:52:41 PDT 2000


At 3:55 PM +0200 7/25/00, Christian Bühler wrote:
>Hi there
>
>I have problems with special Characters like ä,ö,ü ...
>
>I woult like to write something like this
>
>Element rootElement = new Element("root");
>Document domOut    = new Document(rootElement);
>rootElement.setContent("für ein Eis öffne ich");
>
>and there should be an output like this;
><root>f&#252r ein Eis &#246ffne ich</root>
>
>Is there a possibility to get the convertion automatic.
>

It would be nice for XMLOutputter to do that. However pre-1.4 Java 
doesn't really give us the APIs we need to do that. (Well it does, 
but they're hiding off in the undocumented sun.io packages).  For now 
you're better off using UTF-8.

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
|                  The XML Bible (IDG Books, 1999)                   |
|              http://metalab.unc.edu/xml/books/bible/               |
|   http://www.amazon.com/exec/obidos/ISBN=0764532367/cafeaulaitA/   |
+----------------------------------+---------------------------------+
|  Read Cafe au Lait for Java News:  http://metalab.unc.edu/javafaq/ |
|  Read Cafe con Leche for XML News: http://metalab.unc.edu/xml/     |
+----------------------------------+---------------------------------+



More information about the jdom-interest mailing list