我升级我的httpmime包,现在我的字符串不发送或接收为UTF-8MultipartEntityBuilder和字符集
MultipartEntityBuilder entity = MultipartEntityBuilder.create();
Charset chars = Charset.forName("UTF-8");
entity.setCharset(chars);
entity.addTextBody("some_text", some_text);
HttpPost httppost = new HttpPost(url);
httppost.setEntity(entity.build());
...and so on..
我失去了什么? 我用来建立一个StringBody并设置在stringbody的字符集,但现在已被弃用,它只是似乎没有工作
至于文档页面http://hc.apache.org/httpcomponents-client-ga/httpmime/apidocs/org/apache/http/entity/mime/content/StringBody.html#StringBody(java.lang.String ,org.apache.http.entity.ContentType)说,StringBody(String text,ContentType contentType,Charset charset)在4.3.x中不推荐使用 – HirofumiTamori