なんだろこんなにたくさんある意味がわからん。
(ノ・・)ン。。。。。。(((●コロコロッ
調べてみるとJavaScript?のurlencode関数はたくさんあるようだ。
それって・・・何のために?
encode関数とdecode関数はこんな感じで対応
encodeURI() - decodeURI() encodeURIComponent() - decodeURIComponent() escape() - unescape()
そして対応ブラウザはと言うと
encodeURI() Firefox IE5.5 NN4 encodeURIComponent() Firefox IE5.5 NN4 escape() Firefox IE3
これはつまり歴史的な理由と言うことかな。
一つ一つみてみよう。
Encodes a string, replacing certain characters with a hexadecimal escape equence.
escapeは調べてみると正確には関数ではないらしい
DOMでwindowクラス内のescapeメソッド。
Syntax regular = window.escape(escaped)
デコードするときはunescapeメソッドを使う
Syntax regular = window.unescape(escaped)
Encodes a Uniform Resource Identifier (URI) by replacing each instance of certain characters by one, two, or three escape sequences representing the UTF-8 encoding of the character.
変換する対象はURI。
Syntax encodeURI(URI)
Encodes a Uniform Resource Identifier (URI) component by replacing each instance of certain characters by one, two, or three escape sequences representing the UTF-8 encoding of the character.
変換する対象は文字列。
Syntax encodeURIComponent(String)
PHPのregister_globalsをonにしているとメチャメチャ危険と、
マニュアルに書いているのが面白い。