URLEncoder与URLDecoder

来源:互联网 发布:农村淘宝咨询电话 编辑:程序博客网 时间:2024/06/07 14:01
packge haizhu.com.InetDemoimport java.net.URLDecoder;import java.net.URLEncoder;public class CodeDemo{    public static void main(String[] args) throws Exception{        String keyword = "haizhu 海竹";        String encode = URLEncoder.encode(keyWord, "UTF-8");        String decode = URLDecoder.decode(encode, "UTF-8");        System.out.println("编码之后的内容:"+encode);        System.out.println("解码之后的内容:"+decode);    }}运行结果:编码之后的内容:haizhu+%E6%B5%B7%E7%AB%B9  解码之后的内容:haizhu 海竹  

参考文章:
http://blog.csdn.net/haizhu668/article/details/9708867

原创粉丝点击