var decoded = encoded.replace(/&/g,'&');

http://stackoverflow.com/questions/3700326/decode-amp-back-to-in-javascript

 

 

Technically, and often in practice, the up-voted answer is not correct.

Uri.EscapeUriString or HttpUtility.UrlPathEncode is the correct way to escape a string meant to be part of a URL.

Take for example the string "Stack Overflow":

  • HttpUtility.UrlEncode("Stack Overflow") --> "Stack+Overflow"

  • Uri.EscapeUriString("Stack Overflow") --> "Stack%20Overflow"

  • Uri.EscapeDataString("Stack + Overflow") --> Also encodes "+" to "%2b" ---->Stack%20%2B%20%20Overflow

相关文章:

  • 2021-05-29
  • 2021-09-05
  • 2021-12-20
  • 2021-12-16
  • 2021-07-30
  • 2021-10-16
  • 2021-12-24
  • 2022-12-23
猜你喜欢
  • 2021-05-06
  • 2022-01-18
  • 2021-05-29
  • 2022-12-23
  • 2021-05-02
  • 2021-11-09
  • 2021-10-03
相关资源
相似解决方案