首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

cookie汉语言乱码解决

2013-11-08 
cookie中文乱码解决%Stringvalue URLEncoder.encode(hello中文)Cookie cookie new Cookie(hello

cookie中文乱码解决
   <%
      String  value = URLEncoder.encode("hello中文");
      Cookie cookie = new Cookie("hello",value);
      cookie.setMaxAge(1000*60*60*24);
      cookie.setPath("/jsp");
      response.addCookie(cookie);
      out.println("添加成功");
    %>



  <%
   Cookie[] cookies = request.getCookies();
    if(cookies!=null){
    Cookie cookie = cookies[1];
    out.println("===hello==="+cookie.getName()+"-----"+URLDecoder.decode(cookie.getValue()));
    }
 
   %>

热点排行