//在 new StringEntity(params, "utf-8")指定為utf-8編碼 try { HttpClient client = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(url); //設置編碼,防止中文傳輸亂碼 StringEntity entity = new StringEntity(contentValue.toString(), "utf-8"); httpPost.setEntity(entity); HttpResponse response = client.execute(httpPost); //獲取響應碼 status = response.getStatusLine().getStatusCode(); //status = response.getStatusLine().getStatusCode(); Log.v("jsondata", "resp = " + response.getEntity().toString()); Log.v("jsondata", "status = " + status + "\n" + contentValue.toString()); }catch(Exception e){ Log.v("jsondata", "exception"); e.printStackTrace(); }
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。