Luar's Flash Playground:AS1/2 escape()和AS3 escape() 是不同
新聞(100)
觀點或評論(93)
Flash書(63)
教程(65)
Design Patterns(3)
FlashCom筆記(45)
Flash Remoting筆記(27)
Flex筆記(11)
Flash Lite筆記(14)
PHP資訊(22)
Ajax筆記(9)
習作(46)
組件(15)
酷站(31)
學習資源(28)
書籍推介(15)
本站與我(90)
RSS瀏覽器
聯絡
熱愛鑽研
Ajax
ActionScript
Flash
Flash Lite
Flex
Flash Remoting
FlashCom
Director
Lingo
PHP
Multiplayer Game

搜尋
VCASMO
AS1/2 escape()和AS3 escape() 是不同 (19-01-2007)

在英文開發環境,未必容易察覺,因為AS1/2 escape()和AS3 escape() return相同結果,但是在double-byte文字,AS3 escape()終於跟JavaScript的做法相同,如果你要以前AS1/2的格式,你要用encodeURI()或者encodeURIComponent()。

ActionScript 1/2

var a:String = "香港:";
trace(escape(a)); // %E9%A6%99%E6%B8%AF%3A

ActionScript 3

var a:String = "香港:";
trace(escape(a)); // %u9999%u6E2F%3A
trace(encodeURI(a)); // %E9%A6%99%E6%B8%AF:
trace(encodeURIComponent(a)); // %E9%A6%99%E6%B8%AF%3A

JavaScript

var a = "香港:";
alert(escape(a)); // %u9999%u6E2F%3A
alert(encodeURI(a)); // %E9%A6%99%E6%B8%AF:
alert(encodeURIComponent(a)); // %E9%A6%99%E6%B8%AF%3A

本文章由luar發表。
意見
  • escape()函数是干吗用的?搞乱码?

    lele於24-01-2007發表

  • useful

    iu99於04-02-2007發表

  • escape 函数
    escape(expression:String) : String

    将参数转换为字符串,并以 URL 编码格式对其进行编码,在这种格式中,所有非字母数字的字符都替换为 % 十六进制序列。当用于 URL 编码的字符串中时,百分号 (%) 用于引入转义符,不与模运算符 (%) 等效。


    lele网友不要自己不先看看就随便说嘛

    helen於10-02-2007發表

同組文章

Movable Type 3.15系統支持,Luar's Production版權所有。