escape関数などエスケープ系の関数でエスケープできる文字列
JavaScriptではescape関数やencodeURI関数、encodeURIComponent関数など様々なエスケープ関数が用意されています。
各関数でエスケープ可能な文字列は以下のとおりです。
文字列 | escape | encodeURI | encodeURIComponent |
---|---|---|---|
0-9 | ☓ | ☓ | ☓ |
a-z,A-Z | ☓ | ☓ | ☓ |
日本語※ | ◯ | ◯ | ◯ |
“%<>[]^`{}| | ◯ | ◯ | ◯ |
!'()~ | ◯ | ☓ | ☓ |
#$&:;,? | ◯ | ☓ | ◯ |
+/@ | ☓ | ☓ | ◯ |
*-._ | ☓ | ☓ | ☓ |
※ escape関数とencodeURI関数、encodeURIComponent関数ではエンコード形式が異なります。
unescape(), decodeURI(), decodeURIComponent() を使ってデコードできる文字列も同じです。
登録日 : 2012年11月23日 最終更新日 : 2012年11月23日