开发者

Soap character encoding in Android

开发者 https://www.devze.com 2023-04-11 17:04 出处:网络
I can call webservices via the code that I am sharing below and it\'s ok but while I am sending a value to parameter with turkish characters there is coming up an encoding problem. When I change the e

I can call webservices via the code that I am sharing below and it's ok but while I am sending a value to parameter with turkish characters there is coming up an encoding problem. When I change the encode charset utf-8 to iso-8859-9, some turkish chars get correct displayed (ç, ö, ü) but 3 letters (ı, ğ, ş) does not change. why does this happen?

abcçdefg*?h?*ijklmnoöprs?tuüvyz must be: abcçdefg*ğ*h*ı*ijklmnoöprs*ş*tuüvyz

final DefaultHttpClient httpClient=new DefaultHttpClient(); HttpParams params = httpClient.getParams();
        HttpConnectionParams.setConnectionTimeout(params, 10000);
        HttpConnectionParams.setSoTimeout(params, 15000);
        // set parameter
        HttpProtocolParams.setUseExpectContinue(httpClient.getParams(), true);

      开发者_如何学Go  // POST the envelope
        HttpPost httppost = new HttpPost(parameters[0]);
        // add headers
        httppost.setHeader("soapaction", parameters[1]);
        httppost.setHeader("Content-Type", "text/xml; charset=iso-8859-9");

        String responseString="";
        try {

            HttpEntity entity = new StringEntity(parameters[2]); 
            httppost.setEntity(entity);

            // extended class from BasicResponseHandler
            ResponseHandler<String> rh=new ResponseHandlerTr();

            responseString=httpClient.execute(httppost, rh); 

        } 
        catch (Exception e) {
            Log.v("exception", e.toString());
        }

        // close the connection
        httpClient.getConnectionManager().shutdown();
        return responseString;
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号