ActionScript 3.0では、escape()関数の動作が2.0/1.0とは一部変わりました。たとえば、"F-siteセミナー"という文字列をescape()関数でURLエンコードすると、ActionScript 3.0と2.0/1.0の結果はそれぞれつぎのような文字列になります。
【ActionScript 3.0】
F-site%u30BB%u30DF%u30CA%u30FC
【ActionScript 2.0/1.0】
F%2Dsite%E3%82%BB%E3%83%9F%E3%83%8A%E3%83%BC
実は、JavaScriptのescape()関数も、Unicodeをサポートするブラウザ上では、ActionScript 3.0と同じ結果を返します。変換対象はASCII文字以外なので、ハイフン("-")はそのまま返します。また、Unicodeをサポートするブラウザでは、2バイト文字を「%uxxxxという形式で2バイト文字にエンコードします」。この仕様は、ECMA-262にもとづくようです。
ActionScript 2.0/1.0のescape()関数は、2バイト文字をUTF-8でエンコードしていました。ActionScript 3.0で文字列をUTF-8でエンコードするには、flash.utils.escapeMultiByte()関数を用います[*1]。
import flash.utils.escapeMultiByte;
var _str:String = escapeMultiByte("F-siteセミナー");
trace(_str); // 出力: F%2Dsite%E3%82%BB%E3%83%9F%E3%83%8A%E3%83%BC
[*1] デコードするには、flash.utils.unescapeMultiByte()関数を使います。なお、これらの関数については、akihiro kamijo「文字列のエスケープ」をご参照ください。
http://f-site.org/mt3/mt-tb.cgi/108
この記事へのコメント
●1.akipponn(2007年10月04日 16:23)
ありがとうございます。救われました~!
●2.shinro(2007年11月14日 16:32)
同じく救われました。ありがとうございました~!
●3.hayato_hoshikawa(2009年05月06日 16:11)
またまた救われました〜。ありがとうございます!
●4.匿名(2009年08月05日 16:44)
ぼくもすくわれました!ありがとうございます!
●5.ggs(2010年03月01日 14:08)
はぅあ!救われました〜!
●6.dig(2010年03月11日 12:12)
You rescued ours from danger.
●7.co(2010年04月12日 20:30)
情報ありがとうございましたー!
救われましたー!
●8.Batawradway(2012年01月18日 06:53)
tramadol efflexor cheap tramadol with free shipping ranitidine cheap tramadol
manufacturers of tramadol tramadol no prescr1ption employees view of tramadol abuse
best price thailand tramadol codeine ultram tramadol overnight delivery tramadol unrination
tramadol online no consultation fee tramadol drug low cost tramadol