encodeURIComponent encodeURI escape
System.useCodePage
public function decodeURI(uri:String):String
语言版本: ActionScript 3.0
运行时版本: AIR 1.0 Flash Player 9, Flash Lite 4
将已编码的 URI 解码为字符串。返回一个字符串,其中以前由 encodeURI 函数编码的所有字符都还原为它们的未编码表示形式。
下表显示不会 由 decodeURI 函数解码为字符的转义序列的集合。使用 decodeURIComponent() 可解码此表中的转义序列。
未解码的转义序列 字符等效形式
%23 #
%24 $
%26 &
%2B +
%2C ,
%2F /
%3A :
%3B ;
%3D =
%3F ?
%40 @
参数 uri:String — 一个使用 encodeURI 函数编码的字符串。
返回 String — 一个字符串,其中以前由 encodeURI 函数转义的所有字符都还原为它们的未转义表示形式。
另请参见
decodeURIComponent()
encodeURI()
encodeURIComponent()
示例 ( 如何使用本示例 )
package {
import flash.display.Sprite;
public class DecodeURIExample extends Sprite {
public function DecodeURIExample() {
var uri:String = "http://www.example.com/application.jsp?user=<user name='some user'></user>";
var encoded:String = encodeURI(uri);
var decoded:String = decodeURI(encoded);
trace(uri); // http://www.example.com/application.jsp?user=<user name='some user'></user>
trace(encoded); // http://www.example.com/application.jsp?user=%3Cuser%20name='some%20user'%3E%3C/user%3E
trace(decoded); // http://www.example.com/application.jsp?user=<user name='some user'></user>
}
}
}
decodeURIComponent () 函数
public function decodeURIComponent(uri:String):String
语言版本: ActionScript 3.0
运行时版本: AIR 1.0 Flash Player 9, Flash Lite 4
将已编码的 URI 组件解码为字符串。返回一个字符串,其中以前由 encodeURIComponent 函数转义的所有字符都还原为它们的未编码表示形式。
此函数与 decodeURI() 函数不同,它仅适用于 URI 字符串的一部分(称为 URI 组件)。URI 组件是指出现在某些特殊字符之间的任何文本,这些特殊字符称为组件分隔符 (: / ; and ? ). “http”和“www.adobe.com”是常见的 URI 组件示例。
此函数与 decodeURI() 的另一个重要区别是:由于此函数假定它处理的是 URI 组件,因此它会将表示特殊分隔符字符 (; / ? : @ & = + $ , #) 的转义序列视为应进行解码的常规文本。
参数 uri:String — 一个使用 encodeURIComponent 函数编码的字符串。
返回 String — 一个字符串,其中以前由 encodeURIComponent 函数转义的所有字符都还原为它们的未转义表示形式。
另请参见
decodeURI()
encodeURI()
encodeURIComponent()
encodeURI () 函数
public function encodeURI(uri:String):String
语言版本: ActionScript 3.0
运行时版本: AIR 1.0 Flash Player 9, Flash Lite 4
将字符串编码为有效的 URI(统一资源标识符)。将完整的 URI 转换为一个字符串,其中除属于一小组基本字符的字符外,其它所有字符都以 UTF-8 转义序列进行编码。
下表显示不会 由 encodeURI 函数转换为 UTF-8 转义序列的基本字符的整个集合。
未编码的字符
0 1 2 3 4 5 6 7 8 9
a b c d e f g h i j k l m n o p q r s t u v w x y z
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
; / ? : @ & = + $ , #
- _ . ! ~ * ' ( )
参数 uri:String — 一个表示完整 URI 的字符串。
返回 String — 一个字符串,其中某些字符已编码为 UTF-8 转义序列。
另请参见
decodeURI()
decodeURIComponent()
encodeURIComponent()
示例 ( 如何使用本示例 )
package {
import flash.display.Sprite;
public class EncodeURIExample extends Sprite {
public function EncodeURIExample() {
var uri:String = "http://www.example.com/application.jsp?user=<user name='some user'></user>";
var encoded:String = encodeURI(uri);
var decoded:String = decodeURI(encoded);
trace(uri); // http://www.example.com/application.jsp?user=<user name='some user'></user>
trace(encoded); // http://www.example.com/application.jsp?user=%3Cuser%20name='some%20user'%3E%3C/user%3E
trace(decoded); // http://www.example.com/application.jsp?user=<user name='some user'></user>
}
}
}
encodeURIComponent () 函数
public function encodeURIComponent(uri:String):String
语言版本: ActionScript 3.0
运行时版本: AIR 1.0 Flash Player 9, Flash Lite 4
将字符串编码为有效的 URI 组件。将 URI 的子字符串转换为一个字符串,其中除属于非常小的一组基本字符的字符外,其它所有字符都以 UTF-8 转义序列进行编码。
encodeURIComponent() 函数与 encodeURI() 函数不同,它仅适用于 URI 字符串的一部分(称为 URI 组件)。URI 组件是指出现在某些特殊字符之间的任何文本,这些特殊字符称为组件分隔符 (: / ; and ? ). “http”和“www.adobe.com”是常见的 URI 组件示例。
此函数与 encodeURI() 的另一个重要区别是:由于此函数假定它处理的是 URI 组件,因此它会将特殊分隔符字符 (; / ? : @ & = + $ , #) 视为应进行编码的常规文本。
下表显示不会 由 encodeURIComponent 函数转换为 UTF-8 转义序列的所有字符。
未编码的字符
0 1 2 3 4 5 6 7 8 9
a b c d e f g h i j k l m n o p q r s t u v w x y z
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
- _ . ! ~ * ' ( )
参数 uri:String
返回 String
另请参见
decodeURI()
decodeURIComponent()
encodeURI()
escape () 函数
public function escape(str:String):String
语言版本: ActionScript 3.0
运行时版本: AIR 1.0 Flash Player 9, Flash Lite 4
将参数转换为字符串,并以 URL 编码格式对其进行编码,在这种格式中,大多数非字母数字的字符都替换为 % 十六进制序列。当用于 URL 编码的字符串时,百分号 (%) 用于引入转义字符,不与 modulo 运算符 (%) 等效。
下表显示不会 由 escape() 函数转换为转义序列的所有字符。
未编码的字符
0 1 2 3 4 5 6 7 8 9
a b c d e f g h i j k l m n o p q r s t u v w x y z
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
@ - _ . * + /
参数 str:String — 要转换为字符串并以 URL 编码格式进行编码的表达式。
返回 String — 一个 URL 编码的字符串。
另请参见
unescape()
System.useCodePage
public function decodeURI(uri:String):String
语言版本: ActionScript 3.0
运行时版本: AIR 1.0 Flash Player 9, Flash Lite 4
将已编码的 URI 解码为字符串。返回一个字符串,其中以前由 encodeURI 函数编码的所有字符都还原为它们的未编码表示形式。
下表显示不会 由 decodeURI 函数解码为字符的转义序列的集合。使用 decodeURIComponent() 可解码此表中的转义序列。
未解码的转义序列 字符等效形式
%23 #
%24 $
%26 &
%2B +
%2C ,
%2F /
%3A :
%3B ;
%3D =
%3F ?
%40 @
参数 uri:String — 一个使用 encodeURI 函数编码的字符串。
返回 String — 一个字符串,其中以前由 encodeURI 函数转义的所有字符都还原为它们的未转义表示形式。
另请参见
decodeURIComponent()
encodeURI()
encodeURIComponent()
示例 ( 如何使用本示例 )
package {
import flash.display.Sprite;
public class DecodeURIExample extends Sprite {
public function DecodeURIExample() {
var uri:String = "http://www.example.com/application.jsp?user=<user name='some user'></user>";
var encoded:String = encodeURI(uri);
var decoded:String = decodeURI(encoded);
trace(uri); // http://www.example.com/application.jsp?user=<user name='some user'></user>
trace(encoded); // http://www.example.com/application.jsp?user=%3Cuser%20name='some%20user'%3E%3C/user%3E
trace(decoded); // http://www.example.com/application.jsp?user=<user name='some user'></user>
}
}
}
decodeURIComponent () 函数
public function decodeURIComponent(uri:String):String
语言版本: ActionScript 3.0
运行时版本: AIR 1.0 Flash Player 9, Flash Lite 4
将已编码的 URI 组件解码为字符串。返回一个字符串,其中以前由 encodeURIComponent 函数转义的所有字符都还原为它们的未编码表示形式。
此函数与 decodeURI() 函数不同,它仅适用于 URI 字符串的一部分(称为 URI 组件)。URI 组件是指出现在某些特殊字符之间的任何文本,这些特殊字符称为组件分隔符 (: / ; and ? ). “http”和“www.adobe.com”是常见的 URI 组件示例。
此函数与 decodeURI() 的另一个重要区别是:由于此函数假定它处理的是 URI 组件,因此它会将表示特殊分隔符字符 (; / ? : @ & = + $ , #) 的转义序列视为应进行解码的常规文本。
参数 uri:String — 一个使用 encodeURIComponent 函数编码的字符串。
返回 String — 一个字符串,其中以前由 encodeURIComponent 函数转义的所有字符都还原为它们的未转义表示形式。
另请参见
decodeURI()
encodeURI()
encodeURIComponent()
encodeURI () 函数
public function encodeURI(uri:String):String
语言版本: ActionScript 3.0
运行时版本: AIR 1.0 Flash Player 9, Flash Lite 4
将字符串编码为有效的 URI(统一资源标识符)。将完整的 URI 转换为一个字符串,其中除属于一小组基本字符的字符外,其它所有字符都以 UTF-8 转义序列进行编码。
下表显示不会 由 encodeURI 函数转换为 UTF-8 转义序列的基本字符的整个集合。
未编码的字符
0 1 2 3 4 5 6 7 8 9
a b c d e f g h i j k l m n o p q r s t u v w x y z
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
; / ? : @ & = + $ , #
- _ . ! ~ * ' ( )
参数 uri:String — 一个表示完整 URI 的字符串。
返回 String — 一个字符串,其中某些字符已编码为 UTF-8 转义序列。
另请参见
decodeURI()
decodeURIComponent()
encodeURIComponent()
示例 ( 如何使用本示例 )
package {
import flash.display.Sprite;
public class EncodeURIExample extends Sprite {
public function EncodeURIExample() {
var uri:String = "http://www.example.com/application.jsp?user=<user name='some user'></user>";
var encoded:String = encodeURI(uri);
var decoded:String = decodeURI(encoded);
trace(uri); // http://www.example.com/application.jsp?user=<user name='some user'></user>
trace(encoded); // http://www.example.com/application.jsp?user=%3Cuser%20name='some%20user'%3E%3C/user%3E
trace(decoded); // http://www.example.com/application.jsp?user=<user name='some user'></user>
}
}
}
encodeURIComponent () 函数
public function encodeURIComponent(uri:String):String
语言版本: ActionScript 3.0
运行时版本: AIR 1.0 Flash Player 9, Flash Lite 4
将字符串编码为有效的 URI 组件。将 URI 的子字符串转换为一个字符串,其中除属于非常小的一组基本字符的字符外,其它所有字符都以 UTF-8 转义序列进行编码。
encodeURIComponent() 函数与 encodeURI() 函数不同,它仅适用于 URI 字符串的一部分(称为 URI 组件)。URI 组件是指出现在某些特殊字符之间的任何文本,这些特殊字符称为组件分隔符 (: / ; and ? ). “http”和“www.adobe.com”是常见的 URI 组件示例。
此函数与 encodeURI() 的另一个重要区别是:由于此函数假定它处理的是 URI 组件,因此它会将特殊分隔符字符 (; / ? : @ & = + $ , #) 视为应进行编码的常规文本。
下表显示不会 由 encodeURIComponent 函数转换为 UTF-8 转义序列的所有字符。
未编码的字符
0 1 2 3 4 5 6 7 8 9
a b c d e f g h i j k l m n o p q r s t u v w x y z
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
- _ . ! ~ * ' ( )
参数 uri:String
返回 String
另请参见
decodeURI()
decodeURIComponent()
encodeURI()
escape () 函数
public function escape(str:String):String
语言版本: ActionScript 3.0
运行时版本: AIR 1.0 Flash Player 9, Flash Lite 4
将参数转换为字符串,并以 URL 编码格式对其进行编码,在这种格式中,大多数非字母数字的字符都替换为 % 十六进制序列。当用于 URL 编码的字符串时,百分号 (%) 用于引入转义字符,不与 modulo 运算符 (%) 等效。
下表显示不会 由 escape() 函数转换为转义序列的所有字符。
未编码的字符
0 1 2 3 4 5 6 7 8 9
a b c d e f g h i j k l m n o p q r s t u v w x y z
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
@ - _ . * + /
参数 str:String — 要转换为字符串并以 URL 编码格式进行编码的表达式。
返回 String — 一个 URL 编码的字符串。
另请参见
unescape()