Loading

URL 编码

                //按照UTF-8进行编码 
                string tempSearchString1 = System.Web.HttpUtility.UrlEncode("C#中国");
                Response.Write(tempSearchString1);
                Response.Write(HttpUtility.UrlDecode(tempSearchString1));

                //按照GB2312进行编码 
                string tempSearchString2 = System.Web.HttpUtility.UrlEncode("C#中国", System.Text.Encoding.GetEncoding("GB2312"));
                Response.Write(tempSearchString2);
                Response.Write(HttpUtility.UrlDecode(tempSearchString2, System.Text.Encoding.GetEncoding("GB2312")));

 

posted @ 2012-09-28 14:36  The Mechanic  阅读(148)  评论(0编辑  收藏  举报