编程语言
首页 > 编程语言> > 廖雪峰Java10加密与安全-2加密算法-1URL编码

廖雪峰Java10加密与安全-2加密算法-1URL编码

作者:互联网

1.URL编码

URL编码是浏览器发送数据给服务器时使用的编码。
如通过百度搜索美女:

URL编码规则:

public class SplitString {
    public static void main(String[] args) throws Exception{
        String original = "URL参数";
        //编码后
        String encoded = URLEncoder.encode(original,"UTF-8");
        System.out.println("编码后:"+encoded);
        //解码
        String ori = new String(URLDecoder.decode(encoded,"UTF-8"));
        System.out.println("解码后:"+ori);
        char[] cs = original.toCharArray();
    }
}

2.总结:

标签:编码,UTF,Java10,1URL,URL,encoded,original,加密算法,String
来源: https://www.cnblogs.com/csj2018/p/10827345.html