使用URLEncoder、URLDecoder进行URL参数的转码与解码

来源:互联网 发布:淘宝客注册要钱吗 编辑:程序博客网 时间:2024/05/23 02:01

http://blog.csdn.net/jackpk/article/details/5494156


String strTest = "?=abc?中%1&2<3,4>";
  strTest = URLEncoder.encode(strTest, "UTF-8");
  System.out.println(strTest);
  strTest = URLDecoder.decode(strTest,"UTF-8");
  System.out.println(strTest);

 

 

执行结果:

%3F%3Dabc%3F%E4%B8%AD%251%262%3C3%2C4%3E
?=abc?中%1&2<3,4>

0 0
原创粉丝点击