JAVA网络编程URL编解码
2021-03-11 18:28
标签:main enc except out throws 网络 coder encoder exception JAVA网络编程URL编解码 标签:main enc except out throws 网络 coder encoder exception 原文地址:https://www.cnblogs.com/xl4ng/p/14122749.htmlimport java.net.URLDecoder;
import java.net.URLEncoder;
public class CodeDemo {
public static void main(String[] args) throws Exception {
String keyWord = "哇哈哈";
String encode = URLEncoder.encode(keyWord, "UTF-8");
System.out.println("编码之后的内容:"+encode);
String decode = URLDecoder.decode(encode, "UTF-8");
System.out.println("解码之后的内容:"+decode);
}
}