I have the following restful client in python:
import requests;
s= 'وإليك ما يقوله إثنان من هؤلاء';
resp = requests.post('http://localhost:8080/MyApp/webresources/production/sendSentence', json={'sentence': s,} )
the aforementionned code call a web service implemented in java which returns the same sentence sent from the requests client.
this is the java webservice:
@POST
@Consumes("application/json")
@Produces("text/html; charset=UTF-8")
@Path("/sendSentence")
public String sendSentence(@Context HttpServletRequest requestContext, String valentryJson) throws Exception {
    try {
        if (valentryJson != null) {
            JSONObject jsonObject;
            jsonObject = new JSONObject(valentryJson);
            String sentence = jsonObject.getString("sentence");
            return sentence;
        }
    } catch (JSONException ex) {
    }
    return "";
}
the problem is the encoding because when i try to print the content this is the result:
>>> resp.content
'\xd9\x88\xd8\xa5\xd9\x84\xd9\x8a\xd9\x83 \xd9\x85\xd8\xa7 \xd9\x8a\xd9\x82\xd9\x88\xd9\x84\xd9\x87 \xd8\xa5\xd8\xab\xd9\x86\xd8\xa7\xd9\x86 \xd9\x85\xd9\x86 \xd9\x87\xd8\xa4\xd9\x84\xd8\xa7\xd8\xa1'
Or when I use print:
>>> print resp.content
    ظˆط¥ظ„ظٹظƒ ظ…ط§ ظٹظ‚ظˆظ„ظ‡ ط¥ط«ظ†ط§ظ† ظ…ظ† ظ‡ط¤ظ„ط§ط،
 
     
    