Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encodeURI、encodeURIComponent、escape -- javascript 编码和解码函数 #15

Open
iwalking11 opened this issue Dec 22, 2018 · 0 comments

Comments

@iwalking11
Copy link
Owner

1. encodeURI():

  • 主要用于整个URI
  • 对空格进行编码
  • 不会对本身属于URI的特殊字符进行编码,例如":","/","?","#"

2. encodeURIComponent():

  • 主要用于URI中的某一段
  • 会对发现的任何非标准字符进行编码

3. escape():

  • 不会对 ASCII 字母和数字进行编码,
  • 不会对下面这些 ASCII 标点符号进行编码: * @ - _ + . /
  • 其他所有的字符都会被转义序列替换。
  • ECMAScript v3 反对使用该方法,应用使用 decodeURI() 和 decodeURIComponent() 替代它。

参考:https://blog.csdn.net/cuew1987/article/details/10952509

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant