Hi Oleg

@@ -119,10 +120,13 @@
         SOAPEnvelope envelope = null;
         try {
             String contentType = response.getFirstHeader(HTTP.CONTENT_TYPE).getValue();
+            String charSetEnc = BuilderUtil.getCharSetEncoding(contentType);
+            if (charSetEnc == null) {
+                charSetEnc = MessageContext.DEFAULT_CHAR_SET_ENCODING;
+            }
+
             if (contentType.indexOf(HTTP.CHARSET_PARAM) > 0) {
-                responseMsgCtx.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING,
-                    contentType.substring(contentType.indexOf(HTTP.CHARSET_PARAM) +
-                    HTTP.CHARSET_PARAM.length()));
+                responseMsgCtx.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEnc);
             } else {
                 responseMsgCtx.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING,
    

Hi Asankha,

HttpCore API provides a number of utilities optimized for easy and
efficient tokenization of HTTP headers. Header#getElements() method can
parse the header value into an array of header elements with virtually
zero intermediate garbage on the heap. One could also use the
EntityUtils#getContentCharSet() method to obtain the content charset
used to encode the body of an HTTP message.

For what it is worth to you.
  
Thanks, I didn't notice that method earlier.. However in this instance I am changing the previous (buggy) code used to read the charset encoding, to now use the Axis2 recommended common utility class (BuilderUtil) that should be shared between all Axis2 transports. (The builders and serializers decide how to write and read messages into/from the transports (e.g. SOAP/REST/JSON etc)).

Its always nice to know that you are keeping a close tab on this code, and it is very much appreciated.

regards
asankha
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to