简体   繁体   中英

Javascript escape Asp.net encoding

I have an html textbox and am entering double quotes in the text box.

Eg

I "a a person

I am using the Javsacript escape function and it encodes the quote to %22 which is correct

To the last point before hitting the server I have %22 but when I get it at the server by Request as follows:

Request["myJson"].Trim();

The %22 is converted back to "

Please help

  • You'd better not use escape , cause it is deprecated. Use similar function encodeURIComponent .
  • I don't know, what for do you need escaped string on the server, but if you really need it, just apply this function twice.

如果要使用HttpContext.Current.Server.UrlEncode(Request["myJson"].Trim());则可以在服务器端进行所有字符转义HttpContext.Current.Server.UrlEncode(Request["myJson"].Trim());

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM