目的:完成普通字符串和application/x-www-form-urlencoded MIME类型的字符串之间的转换
例子:
public class Demo {
public static void main(String[] args) throws IOException {
String keyWord = URLDecoder.decode("%E5%AD%A6%E4%B9%A0%E7%BC%96%E7%A8%8B", "UTF-8") ;
System.out.println("解码后的字符串:" + keyWord);
String str = "学习编程" ;
String urlStr = URLEncoder.encode(str, "UTF-8") ;
System.out.println("编码后的字符串:" + urlStr);
}
}