public class encode {
public static void main(String[] args) throws UnsupportedEncodingException {
//编码
String mytext = java.net.URLEncoder.encode("{\"province\":\"北京市\",\"city\":\"市辖区\",\"district\":\"东城区\",\"address\":\"北京市东城区东直门南大街11号\"}","utf-8");
//解码
String mytext2 = java.net.URLDecoder.decode(mytext, "utf-8");
System.out.println(mytext);
System.out.println(mytext2);
}
}
时间: 2024-10-11 22:31:13