asp.net,js传递汉字参数乱码

使用Response.Redirect方法传递汉字,有时会发现所传递的值和接收到的内容不符,接收的值丢失几个字或变成一堆乱码.

Response.Redirect(
                                    "~/Public/RoleManagement/EditRole.aspx?RoleID=" + RoleID.ToString()
                                    + "&RoleName=" + Server.UrlEncode(RoleName) + "&RoleDescription=" + Server.UrlEncode(RoleDescription)                           
                               );




使用Response.Redirect方法传递 汉字
页面A传递值的代码:
String Message=Server.UrlEncode("欢迎学习ASP.NET");
Response.Redirect("WebForm2.aspx?Msg="+Message);

页面B接收值的代码:
string Message=Server.UrlDecode("Request.QueryString["Msg"]);

Javascript

strFeatures="dialogWidth=600px;dialogHeight=470px;center=yes;middle=yes ;help=no;status=no;scroll=no";
url=encodeURI("../oBILL/RecipeSel.aspx?Name="+ '张' + "&Hj=" + '22');
showModalDialog(url,window,strFeatures);

原文地址:https://www.cnblogs.com/zhc088/p/690404.html