在前端,decodeURIComponent()方法可以将乱码转为中文
<script>
var href = decodeURIComponent(window.location.href);
alert(href);
</script>
在后端,Server.UrlDecode()方法可以将乱码转为中文
string href = Server.UrlDecode(Request.Url.AbsoluteUri);
Response.Write("<script>alert('" + href + "')</script>");