Search code examples
javaibm-mobilefirstmobilefirst-adaptersmobilefirst-servermfp

IBM MobileFirst platform adapter to adapter call in java doesn't support utf-8 or (arabic lang) in response


when call adapter to adapter using AdaptersAPI in java , getting response as rabish if it contains Arabic letters. below snippet of my code

HttpEntity requestEntity = new StringEntity(new Gson().toJson(params), 
ContentType.APPLICATION_JSON );
    HttpPost httpPost = new HttpPost(url);
    httpPost.setEntity(requestEntity);
    HttpResponse httpResp = adaptersAPI.executeAdapterRequest(httpPost);
    JSONObject response = adaptersAPI.getResponseAsJSON(httpResp);

Solution

  • the problem was found in parsing of json > adaptersAPI.getResponseAsJSON(httpResp);

    my issue resolved by: adding this property -Dfile.encoding=UTF-8 in "jvm.options" ,or change json parsing method