String str = URLEncoder.encode("中国","utf-8");
System.out.println(str);
//解码
String str1=URLDecoder.decode(str, "UTF-8");
System.out.println(str1);
打印结果
%E4%B8%AD%E5%9B%BD
中国
String str = URLEncoder.encode("中国","utf-8");
System.out.println(str);
//解码
String str1=URLDecoder.decode(str, "UTF-8");
System.out.println(str1);
打印结果
%E4%B8%AD%E5%9B%BD
中国
转载于:https://www.cnblogs.com/wonder2636/p/6021978.html