HttpClient PostMethod中文问题


public class UTF8PostMethod extends PostMethod {

public UTF8PostMethod(String url) {
super(url);
}

@Override
public String getRequestCharSet() {
// return super.getRequestCharSet();
return "UTF-8";
}
}

HttpClient client = new HttpClient(); 
PostMethod method = new UTF8PostMethod(apiUrl);

method.setParameter("sendContent", sendContent.replace("@0123456789@", mobile).replace("@content@", content));

if(HttpStatus.SC_OK == client.executeMethod(method)){
//if(true){
Document doc = DocumentHelper.parseText(method.getResponseBodyAsString().trim());

你可能感兴趣的:(mobile)