[jdom-interest] Writing foreign languages to XML

Tom Preston tpreston at amadeusboston.com
Fri Apr 12 05:19:59 PDT 2002


I don't know if Hewbrew is supported by UTF-8.  If not, try a different
encoding scheme.  Look at the bottom of this page:

http://java.sun.com/j2se/1.3/docs/api/java/lang/package-summary.html

Change the 1.3 in the url to  1.4 if that is what you are using...1.4 and
1.3 have major diffs in char encoding it appears.  I have been playing with
1.3 with "ISO-8859-1" and it works for getting British Pounds symbol rather
than ?.  Getting ? indicates that the character is not supported by the
output writer.

Tom


========================================
Date: Thu, 11 Apr 2002 13:21:40 +0200
From: "John L. Webber - Jentro AG" <John.Webber at jentro.com>
Organization: Jentro AG
To: David Treves <dtreves at fastmail.fm>
CC: jdom-interest at jdom.org
Subject: 

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"
encoding="UTF-8"?>

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

John

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?



More information about the jdom-interest mailing list