zoukankan      html  css  js  c++  java
  • escape, encodeURI, encodeURIComponent

    escape 方法 描述 对 String 对象编码以便它们能在所有计算机上可读 语法 escape(charstring) charstring 参数是要编码的 String 对象。 说明 escape 返回一个包含了 charstring 内容的新的 String 对象( Unicode 格式), 所有空格、标点、重音符号以及其他非 ASCII 字符都用 %xx 编码代替,其中 xx 等于表示该字符的十六进制数。 例如,空格返回的是 "%20" 。 字符的值大于 255 的用 %uxxxx 格式存储。 适用于:Global 对象 encodeURI 方法 描述 返回编码为有效的统一资源标识符 (URI) 的字符串。 语法 function encodeURI(URIString : String) : String 参数 URIString 必选。表示编码 URI 的字符串。2007-7-31 备注 encodeURI 方法返回一个已编码的 URI。如果将编码结果传递给 decodeURI,则将返回初始的字符串。encodeURI 不对下列字符进行编码:“:”、“/”、“;”和“?”。请使用 encodeURIComponent 对这些字符进行编码。 适用于:Global 对象 encodeURIComponent 方法 描述 返回编码为统一资源标识符 (URI) 的有效组件的字符串。 语法 function encodeURIComponent(encodedURIString : String) : String 参数 encodedURIString 必选。表示编码 URI 组件的字符串。 备注 encodeURIComponent 方法返回一个已编码的 URI。如果将编码结果传递给 decodeURIComponent,则将返回初始的字符串。因为 encodeURIComponent 方法将对所有字符编码,请注意,如果该字符串代表一个路径,例如 /folder1/folder2/default.html,则其中的斜杠也将被编码,这样,当该字符串作为请求发送到 Web 服务器时它将是无效的。如果字符串中包含多个 URI 组件,请使用 encodeURI 方法进行编码。 适用于:Global 对象 使用最多的应为encodeURIComponent,它是将中文、韩文等特殊字符转换成utf-8格式的url编码,所以如果给后台传递参数需要使用encodeURIComponent时需要后台解码对utf-8支持(form中的编码方式和当前页面编码方式相同) escape不编码字符有69个:*,+,-,.,/,@,_,0-9,a-z,A-Z encodeURI不编码字符有82个:!,#,$,&,',(,),*,+,,,-,.,/,:,;,=,?,@,_,~,0-9,a-z,A-Z encodeURIComponent不编码字符有71个:!, ',(,),*,-,.,_,~,0-9,a-z,A-Z
  • 相关阅读:
    Android JNI的使用方法
    Android4.4中jni的native的方法无法找到的解决方案
    如何解决Your project contains C++ files but it is not using a supported native build system
    android-studio开发NDK错误记录:bash: ../../build/intermediates/classes/debug: is a directory
    Android Studio 编译: Program type already present: XXX 解决方案
    ScriptEngineManager is not available in Android and causes a NoClassDefFoundError
    Android 机器人项目Pepper_Android
    Android 优秀开源项目
    准备开发一个运行在Android上的JavaME模拟器
    上周热点回顾(2.3-2.9)团队
  • 原文地址:https://www.cnblogs.com/aspsmile/p/1673328.html
Copyright © 2011-2022 走看看