java.net.URLEncode编码 与 URLDecode解码问题

  1. String   mytext   =   java.net.URLEncoder.encode("中国",   "utf-8");     

  2.    String   mytext2   =   java.net.URLDecoder.decode(mytext,   "utf-8");     

  3.        

  4.    这两条语句在同一个页面中的话,得到的结果是:     

  5.    mytext:   %E4%B8%AD%E5%9B%BD       

  6.    mytex2:   中国    

  7.     

  8.   String   zhongguo=new      String(request.getParameter("zhongguo").getBytes("iso8859_1"));     

  9.    zhongguo=java.net.URLDecoder.decode(zhongguo,"utf-8");  


你可能感兴趣的:(java.net.URLEncode编码 与 URLDecode解码问题)