how to send string by http post in UTF-8

前端 未结 2 905
萌比男神i
萌比男神i 2020-12-19 09:06

I try to send string \"Привет мир!\"

String link = POST_URL;
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(link);
String          


        
2条回答
  •  粉色の甜心
    2020-12-19 09:44

    This worked for me:

    HttpPost httpPost = new HttpPost("http://someurl.com");
    httpPost.setEntity(new UrlEncodedFormEntity(nameValuePair, HTTP.UTF_8));
    

提交回复
热议问题