Java中对Url编码

1、java.net.URLEncoder.encode("编码的是这里","GB2312")

      java.net.URLDecoder.decode(str,"GB2312");

 

2、base64      

   String url = "/shopping/confirm.action?id=1&name=itzhai";
   String code = new String(Base64.encode(url.getBytes()));
   String url = new String(Base64.decode("L3Nob3BwaW5nL2NvbmZpcm0uYWN0aW9uP2lkPTEmbmFtZT1pdHpoYWk="));

 

你可能感兴趣的:(Java中对Url编码)