`

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

 
阅读更多
String   mytext   =   java.net.URLEncoder.encode("中国",   "utf-8");   
   String   mytext2   =   java.net.URLDecoder.decode(mytext,   "utf-8");   
     
   这两条语句在同一个页面中的话,得到的结果是:   
   mytext:   %E4%B8%AD%E5%9B%BD     
   mytex2:   中国  
  
  String   zhongguo=new      String(request.getParameter("zhongguo").getBytes("iso8859_1"));   
   zhongguo=java.net.URLDecoder.decode(zhongguo,"utf-8");  
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics