public static void main(String[] args) throws UnsupportedEncodingException {
String url="https://img-s-msn-com.akamaized.net/tenant/amp/entityid/AA165W2U非法中文.img";
Matcher matcher =Pattern.compile("[\\u4e00-\\u9fa5]|[\\u3002\\uff1b\\uff0c\\uff1a\\u201c\\u201d\\uff08\\uff09\\u3001\\uff1f\\u300a\\u300b\\u3010\\u3011]").matcher(url);
while (matcher.find()) {
String tmp = matcher.group();
try {
url = url.replaceAll(tmp, java.net.URLEncoder.encode(tmp, "utf-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
System.out.println(url);
}