I'm trying to read the json response of a request post. This is the code ...
connection.getOutputStream().write(paramDataBytes);
Reader in = new BufferedReader(new InputStreamReader (connection.getInputStream(),"UTF-8"));
StringBuilder sb = new StringBuilder();
for(int c;(c=in.read())>=0;)
sb.append((char)c);
String response = sb.toString();
System.out.println(response);
JSONObject myResponse = new JSONObject(response.toString());
but the of response variable is
"?; ?m???×"}?iU?(s? ?0?p?6]p????E??*?Q????*U@?g?-x??1D@ ?H??P?{?a?P??w?KV?"
why?
when I try to create the object "JSONObject myResponse " I have the following error
Exception in thread "main" org.json.JSONException: A JSONObject text must begin with '{' at 1 [character 2 line 1]
at org.json.JSONTokener.syntaxError(JSONTokener.java:505)
at org.json.JSONObject.<init>(JSONObject.java:215)
at org.json.JSONObject.<init>(JSONObject.java:399)
at com.application.HttpRequestRaffle.main.Main2.main(Main2.java:83)
I desperately need help...
this is the response of the request that I do manually through firefox