Javascript equivalent to php's urldecode()

前端 未结 3 1118
南方客
南方客 2020-12-08 13:41

I wrote a custom xml parser and its locking up on special characters. So naturally I urlencoded them into my database.

I can\'t seem to find an equivalent to php\'s

3条回答
  •  [愿得一人]
    2020-12-08 14:18

    Check out this one

    function urldecode (str) {
      return decodeURIComponent((str + '').replace(/\+/g, '%20'));
    }
    

提交回复
热议问题