Difference between escape(), encodeURI(), encodeURIComponent()

前端 未结 5 1345
走了就别回头了
走了就别回头了 2021-01-30 00:32

In JavaScript, what is the difference between these?

  1. escape() / unescape()
  2. encodeuri() / decodeuri()
5条回答
  •  广开言路
    2021-01-30 00:57

    • escape - deprecated, you shouldn't use.

    • encodeURI - replaces all characters except
      ; , / ? : @ & = + $ - _ . ! ~ * ' ( ) # a-z 0-9

    • encodeURIComponent - replaces all characters except
      - _ . ! ~ * ' ( ) a-z 0-9

提交回复
热议问题