axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Johannes Wagener (JIRA)" <>
Subject [jira] Created: (AXIS2-4309) JSONMessageFormatter isnt using the correct charset encoding
Date Wed, 15 Apr 2009 01:42:14 GMT
JSONMessageFormatter isnt using the correct charset encoding

                 Key: AXIS2-4309
             Project: Axis 2.0 (Axis2)
          Issue Type: Bug
    Affects Versions: 1.4.1
            Reporter: Johannes Wagener

When using JSONMessageFormatter, i had some trouble with german umlauts. The response wasnt
in the correct encoding (UTF-8)
After debugging for while, i found out that getJSONWriter in and
is ignoring the requested charset encoding:

    protected XMLStreamWriter getJSONWriter(OutputStream outStream) {
        return new BadgerFishXMLStreamWriter(new OutputStreamWriter(outStream));

In my case outputStreamWriter was writing in CP819 (or something like that), while the response
had a   
Content-Type: application/json;charset=UTF-8

so i changed it to:
    protected XMLStreamWriter getJSONWriter(OutputStream outStream,Charset charset) {
        return new BadgerFishXMLStreamWriter(new OutputStreamWriter(outStream, charset));

when calling getJSONWriter i used:
 Charset charset = Charset.forName(format.getCharSetEncoding());                    
 XMLStreamWriter jsonWriter = getJSONWriter(out,charset);
and catching the UnsupportedEncodingException.

After changing these 2 files, everything worked as expected.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message