package com.sunplus.app;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
public class Encode {
public static void main(String[] args) {
String keyWord = "小张";
try {
String encodeBefore = URLEncoder.encode(keyWord, "utf-8");
System.out.println("编码前:" + encodeBefore);
String encodeEnd = URLDecoder.decode(keyWord, "utf-8");
System.out.println("解码:" + encodeEnd);
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
编码前:%E5%B0%8F%E5%BC%A0
解码:小张
10万+

被折叠的 条评论
为什么被折叠?



