[jdom-interest] Use ISO instead of UTF-8 for caractere encodi ng

Magnus Pettersson Magnus.XX.Pettersson at trab.se
Mon Aug 21 05:58:17 PDT 2000


I had some problems with ISO-8859-1 and solved it like this, maybe it can
help you ...

I had a string that I sent to a servlet, the string was my XML-document with
encoding='iso-8859-1'.

<?xml version='1.0' encoding='iso-8859-1'?>
<xml-doc />

In the servlet I converted the string to preserve the special characters
like this:

String xmlString = new
String(req.getParameter("xml_str").getBytes("ISO-8859-1"),"UTF-8");

(Where "xml_str" contains the string that was received by the servlet.)

In other words: "Read the string with encoding ISO-8859-1  and create a new
string with encoding UTF-8."
In this way a correct translation is made. But yes, the result is in UTF-8
... but again, why not always use UTF-8 and make some translations when
needed ...

::magnus


-----Original Message-----
From: tsasala at hifusion.com [mailto:tsasala at hifusion.com]
Sent: den 21 augusti 2000 13:50
Cc: jdom-interest at jdom.org
Subject: Re: [jdom-interest] Use ISO instead of UTF-8 for caractere
encoding



	Did anyone ever respond to this problem?  We are also having
the same problem.  Specifying UTF-16 in the document doesn't seem
to help since XMLOutputter seems to be writing out UTF-8 every time.
The second parse still blows up.  

	-Tom

Philippe Delrieu wrote:
> 
> I have problem using ISO-8859-1 encodong instead of UTF-8.  Special
> charactere like é àçè are badly encoded.
> Is there a way to specify the encoding of processed character in JDOM
> especialy when generating XML document.
> 
> Regards,
> 
> Philippe Delrieu
> Cybernomade.com
> 
> _______________________________________________
> To control your jdom-interest membership:
>
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com
_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com



More information about the jdom-interest mailing list