[jdom-interest] Character encoding from UTF-8 to ISO-8859-1

dumdum 420 dumdum420 at hotmail.com
Fri Feb 8 07:26:58 PST 2002

Well thanks for all your suggestions!!

I got a very very interesting bit of solution!!!???

We have a WIN2K box and an AIX(IBM-Unix) box. Now I has done something like 
this in my code.

FileInputStream fis = new FileInputStream(filePath);
// ensuring that the feed of XML file is UFT-8 this is important I wonder 
though why?
            InputStreamReader isr = new InputStreamReader(fis,"UTF-8");
            String s = isr.getEncoding();

            Document doc = builder.build(isr);

            Element root = doc.getRootElement();

bytes [] b = root.getElement("xxxxxx").getText().getBytes();

//converting to ISO-8859-1
String s = new String(b,"ISO-8859-1");

Now when I saved this string to ORACLE database it worked perfect.

But that is not all of it. I workked fine on W2K and on AIX it still could 
not handle the EURO(€) character.

Now this was intersting that both the JVMs ,that of W2K and AIX are handling 
the situations in a different fashion.

Anyways I got a situation soleved for the moment but it would have been 
better that I could have done it on AIX avaoiding me to have a workaround 
and wrting a RMI call for this updation.

Thanks a lot and any suggestions for this kind of behavior will really help 



Join the world’s largest e-mail service with MSN Hotmail. 

More information about the jdom-interest mailing list