/** * URL中文字符编码转换 * @param url 含中文字符的URL * @return */ public static String getChineseURICode(String url){ if(ValidateUtil.isEmpty(url)) throw new AppException("URL cannot be null"); Matcher matcher = Pattern.compile("[\u4e00-\u9fa5]").matcher(url); String c = null; URLEncoder urlEncoder = new URLEncoder(); while (matcher.find()) { c = matcher.group(); url = url.replaceAll(c,urlEncoder.encode(c)); } return url; }