UrlEncode编码/UrlDecode解码

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);
        
    }
}

posted @ 2014-11-06 16:37  justin_xiaoshuai  阅读(359)  评论(0编辑  收藏  举报