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

来源:互联网 发布:网络画手是什么意思 编辑:程序博客网 时间:2024/06/06 00:43
  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");   
原创粉丝点击