encodedURIComponent(uriComponent: string | number | boolean)
将utf-8字符串转换成字符的实例
规则:
以下字符不会被转义
字母 数字-
_
.
!
~
*
'
(
)
譬如:
encodeURIComponent('=') // %3D
encodeURIComponent('?') // %3F
避免服务器收到意外的请求,最好使用encodedURIComponent进行编码
encodeURI(uri: string)
将特定字符的每个实例转换成转义序列进行uri编码
返回:新的uri
规则:
以下字符不会被转义
;
,
/
?
:
@
&
=
+
$
字母 数字-
_
.
!
~
*
'
(
)
#
不适用于XMLHTTPRequests,因为&和=不会被转义,但是 GET 和 POST 请求属于特殊符号。但是encodedURIComponent会对这些字符编码。
decodeURIComponent
decodeURIComponent(encodedURIComponent: string)
解码
decodeURI
decodeURI(encodedURI: string)
解码
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。