如果PostMethod提交的是中文字符,需要加上相应的编码格式:
post.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=gbk");
如果GetMethod提交的参数有中文字符,需要先转换成utf-8格式:
URLEncoder.encode("杭州", "utf-8");
httpclient 请求 post、get
猜你喜欢
转载自it1990eye0920.iteye.com/blog/2223372
今日推荐
周排行