哪些字符可以来自 encodeURIComponent()

What characters can come out of encodeURIComponent()?

本文关键字:encodeURIComponent 字符      更新时间:2023-09-26

因为javascript的encodeURIComponent()编码了除

(alphabetic)
(decimal digits)
-
_
.
!
~
*
'
(
)

并将其编码为格式的字符串%{digits}

可以说encodeURIComponent总是返回某种组合

- _ . ! ~ * ' ( ) %

加上数字和字母字符,或者我错过了什么?

此外,是否可以公平地说,此处匹配的任何字符串:

/[^'_'-'.'!'~'*'''(')'d'w'%]/ig.test(string)

因此,肯定没有encodeURIComponent适用于它吗?

根据文档

encodeURIComponent escapes all characters except the following
alphabetic, decimal digits, - _ . ! ~ * ' ( )

所以我会说你是对的。

相关文章:
  • 没有找到相关文章