Android アプリで奇妙なエラーが発生します。このコードは、JSON 文字列を二重にエンコードしているようです。送信する内容は ?{"email":"asdf@asdf.com","password":"asdf"} または ?%7B%22email%22:%22.....
サーバーが見ているのは %257B%2522email%2522:%2522 です .... これは、サーバーが %7B%22email%22:%22 を見ていることを意味します .....
これはサーバーを混乱させます。
なぜこれが起こっているのですか?
ご協力ありがとうございました
//オブジェクトをより適切に定義するために編集
コード:
DefaultHttpClient c = new DefaultHttpClient();
if(cookies!=null)
c.setCookieStore(cookies);
JSONObject jso = new JSONObject():
if(loginNotLogout){
jso.put("email", "email@email.com");
jso.put("password", "PassW0RD");
}
URI u = null;
if(loginNotLogout)
u= new URI("HTTP","www.website.com","/UserService",jso.toString(),"");
else
u= new URI("HTTP","www.website.com","/UserService",jso.toString(),"");
HttpGet httpget = new HttpGet(u);
HttpResponse response = c.execute(httpget);
ret.jsonString = EntityUtils.toString(response.getEntity());