[jdom-interest] Writing foreign languages to XML

John L. Webber - Jentro AG John.Webber at jentro.com
Thu Apr 11 04:21:40 PDT 2002

Hi David,

Try setting using an OutputStreamWriter and setting its encoding to
UTF-8, i.e.

BufferedWriter fileWriter = new BufferedWriter(new
OutputStreamWriter(new FileOutputStream(myFile), "UTF-8"));

Your XML header should also declare UTF-8 encoding: <?xml version="1.0"

I haven't tried this out with Hebrew, but it works fine for me with a
German locale.


David Treves wrote:
> I am trying to write Hebrew content into an XML file using JDOM (last
> Beta version) and it keeps come out as "??? ???" wherever there is a
> Hebrew character.
> Is there some setting I should set in order to use non-English
> characters?

 Jentro AG
 John L. Webber, Software Development
 Peter-Henlein-Strasse 28, 85540 Haar/Munich, Germany
 Tel. +49 89 462 385 0     mailto:John.Webber at jentro.com 
 Fax  +49 89 462 385 29    http://www.jentro.com

More information about the jdom-interest mailing list