[xsl] Encoding of DB distorts special characters?

Subject: [xsl] Encoding of DB distorts special characters?
From: "Pramodh Peddi" <peddip@xxxxxxxxxxxxxxxx>
Date: Fri, 14 Nov 2003 13:13:01 -0500
Hi,
My encoding problem has a good progress.
I appreciate the valuable help so far on this problem. It was the encoding
of the shell/terminal, on which the application server is running, which is
mattering. It was showing correct special characters when the default
encoding of the terminal is ISO8859-1 and spitting ?? when the default
encoding of the terminal is set to ASCII.

Now the problem is shifted further in the flow. We are storing all the data
in the DB. And it showing proper characters (®)  (on UI, we use web browser)
on UI when the data is pulled from a DB having W7ISO8859-1 as encoding. But,
showing some funky characters (like "B.") in place of the ® when the data is
being pulled out of DB having ASCII as encoding. The code is the same for
the server application and client application.

I appreciate any help/advices!!

Thanks,

Pramodh.
----- Original Message -----
From: "J.Pietschmann" <j3322ptm@xxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Tuesday, November 11, 2003 5:13 PM
Subject: Re: [xsl] encoding problem while reading the content in


Pramodh Peddi wrote:
> I am reading an xml file from an sftp location and passing that through
the
> Transformer (using Java1.4.1's API). The xml file has "windows-1252"
> encoding declared. It has special characters like ® directly put in the
> file.
...
> Any one has any suggestions? I would greatly appreciate!

Just avoid dealing with the encoding yourself and leave it to
the XML parser, for example use plain

byte[] rawData = rawfileOutputStream.toByteArray();
transformer.transform(
   new StreamSource(new ByteArrayInputStream(rawData)),
   new StreamResult(new OutputStreamWriter(out));

If the parser can't handle the windows-1252 encoding and barfs,
get another one.
If you want to check the output you should use UTF-8 as encoding
(the default) and use an UTF-8 capable viewer (Emacs 21 will do
on Solaris).

J.Pietschmann


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread