You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Duane Gran <dg...@spinweb.net> on 2003/05/19 13:59:44 UTC

character encoding issue

I am having some trouble with character encoding where non-ascii 
characters (cyrillic, arabic, etc) are malformed when they come over 
Axis.  I've been trying to pinpoint the source of the problem and it 
appears to be related to Axis, but I welcome any hints on how to work 
around the problem.

My web service (rpc) takes a binary file and converts it to an XML 
format and returns the XML as an XSD:String.  There may be preferable 
ways (Document web service?) for returning pure XML, but the first 
version is for simplicity.  The service is deployed on AIX for 
production and Mac OS X for development.

The curious thing is that in development the character encoding works 
just fine, but not on AIX.  I have tested the web service locally on 
the AIX box with a command line version and it works correctly, so I 
don't believe there is any deficiency in Java (1.3.0) on AIX.  My only 
conclusion is that somehow the encoding is lost when it is sent over 
the network via Axis.

Is this familiar to anyone?  Is there a way from the service-side to 
overtly declare the character encoding of the response?  I appreciate 
any pointers.

Duane Gran


RE: character encoding issue

Posted by Samir Shaikh <ss...@worldres.com>.
Hi Duane,

I have been working with non-ascii charecters for a while. The best way is
to make the client and server both aware of the charecterset you are using
to send out your data. There are a few minor open bugs with axis and
international charecters(eg. see bugzilla for bug 18966).. one of them
submitted by myself.

HTH

Samir


-----Original Message-----
From: Duane Gran [mailto:dgran@spinweb.net]
Sent: Monday, May 19, 2003 5:00 AM
To: axis-user@ws.apache.org
Subject: character encoding issue


I am having some trouble with character encoding where non-ascii
characters (cyrillic, arabic, etc) are malformed when they come over
Axis.  I've been trying to pinpoint the source of the problem and it
appears to be related to Axis, but I welcome any hints on how to work
around the problem.

My web service (rpc) takes a binary file and converts it to an XML
format and returns the XML as an XSD:String.  There may be preferable
ways (Document web service?) for returning pure XML, but the first
version is for simplicity.  The service is deployed on AIX for
production and Mac OS X for development.

The curious thing is that in development the character encoding works
just fine, but not on AIX.  I have tested the web service locally on
the AIX box with a command line version and it works correctly, so I
don't believe there is any deficiency in Java (1.3.0) on AIX.  My only
conclusion is that somehow the encoding is lost when it is sent over
the network via Axis.

Is this familiar to anyone?  Is there a way from the service-side to
overtly declare the character encoding of the response?  I appreciate
any pointers.

Duane Gran


Re: character encoding issue

Posted by Mark <ma...@bellsouth.net>.
Not sure if this'll help at all, but I recently implemented a (my first) 
web service that accepts binary data encoded by the client in UTF-8.  I 
fumbled through this for a while, but got it working using the following 
method.

The client has a Java String containing the binary data and encodes it into 
a byte array:
    byte theBytes[] = theData.getBytes("UTF-8");

It then sends the byte array as parameter using the XSD_HEXBIN type:
    call.addParameter("theBytes", XMLType.XSD_HEXBIN, ParameterMode.IN);

The web service simply converts the byte array back to a Java String:
    String myData = new String(theData, "UTF-8");
and is able to use the encoded string as binary data again.

I'm new to Axis, SOAP and Web Services in general, but this process works 
very well in my case...

Mark



At 5/19/2003 07:59 AM, you wrote:
>I am having some trouble with character encoding where non-ascii 
>characters (cyrillic, arabic, etc) are malformed when they come over 
>Axis.  I've been trying to pinpoint the source of the problem and it 
>appears to be related to Axis, but I welcome any hints on how to work 
>around the problem.
>
>My web service (rpc) takes a binary file and converts it to an XML format 
>and returns the XML as an XSD:String.  There may be preferable ways 
>(Document web service?) for returning pure XML, but the first version is 
>for simplicity.  The service is deployed on AIX for production and Mac OS 
>X for development.
>
>The curious thing is that in development the character encoding works just 
>fine, but not on AIX.  I have tested the web service locally on the AIX 
>box with a command line version and it works correctly, so I don't believe 
>there is any deficiency in Java (1.3.0) on AIX.  My only conclusion is 
>that somehow the encoding is lost when it is sent over the network via Axis.
>
>Is this familiar to anyone?  Is there a way from the service-side to 
>overtly declare the character encoding of the response?  I appreciate any 
>pointers.
>
>Duane Gran