URLEncoder.encode(String)是对url中的中文参数进行编码解决乱码
public static String encode(String str) throws UnsupportedEncodingException {
String encodedURL = URLEncoder.encode(str, "UTF-8");
return encodedURL;
}
public static String encode(String str) throws UnsupportedEncodingException {
String encodedURL = URLEncoder.encode(str, "UTF-8");
return encodedURL;
}