URLEncode和URLDecode

   URLEncode.encode(String s,String utf-8) 编码

   URLDEcode.decode(String %2b%,String utf-8) 解码 

用法:

  String text1 = java.net.URLEncoder.encode("中国" ,"utf-8" ); 

  String text2 = java.net.URLDecoder.decode(text1,"utf-8");

text1 输出的是  “中国” 通过 utf-8 编码的内容    类似: %3Dq%26kl%3DXX%2

text2 输出的是  %3Dq%26kl%3DXX%2  通过解码后的结果   “中国”

 

 

原文地址:https://www.cnblogs.com/xinxin-ting/p/10273544.html