C#写入中文cookie用JS读取乱码解决方案

     现象:ASP.NET后台写入中文COOKIE后,前台用JS读取为乱码
     解决:
     后台ASP.NET写入
     HttpContext.Current.Request.Cookies[“cookiename”].Value = System.Web.HttpUtility.UrlEncode(strValue,Encoding.UTF8);
     前台JS读取
     使用decodeURIComponent解码显示
posted @ 2011-09-02 16:28  Byrd  阅读(591)  评论(0编辑  收藏  举报