encoding of response http response body

Viewed 7049

I'm using okhttp library for sending request to rest api. this is my java code for sending request to https:

RequestBody body = RequestBody.create(JSON, requestBody);

    Request request = new Request.Builder().url("https://examplesite.com/json/").post(body)
            .addHeader("Accept", "application/json, text/javascript, */*; q=0.01")
            .addHeader("Accept-Encoding", "gzip").addHeader("Accept-Language", "en-US,en;q=0.8,fa;q=0.6,ar;q=0.4")
            .build();

    Response response = client.newCall(request).execute();
    String res = new String(response.body().string().getBytes("UTF-8"));

    System.out.println(res);

the res variable is: �CU8{$���'L�@R�W*�$��b�H�E�l�K�C� 30��}c&,p��q���)+3�R�28���#SC�

what is the encoding of above text?

this is response header:

Accept:application/json, text/javascript, */*; q=0.01
Accept-Encoding:gzip, deflate
Accept-Language:en-US,en;q=0.8,fa;q=0.6,ar;q=0.4
Connection:keep-alive
Content-Length:95
Content-Type:application/json

I can't understand what is the encoding of the response body. whatever when I send request by postman extension on chrome that response body is a normal json. attend that the protocol is https and I think okhttp library handle encrypting and decripting data.

2 Answers
Related