java中对url地址中的中文进行编码
// URL中汉字编码 private String urlEncodeChinese(String url) { try { Matcher matcher = Pattern.compile("[\u4e00-\u9fa5]").matcher(url); String tmp = ""; while (matcher.find()) { tmp = matcher.group(); url = url.replaceAll(tmp, URLEncoder.encode(tmp, "UTF-8")); } } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return url.replace(" ", "%20"); }