URL encoding: Difference between revisions

added javascript
(added javascript)
Line 103:
 
<pre>http%3A%2F%2Ffoo+bar%2F</pre>
 
=={{header|JavaScript}}==
Confusingly, there are 3 different URI encoding functions in JavaScript: <code>escape()</code>, <code>encodeURI()</code>, and <code>encodeURIComponent()</code>. Each of them encodes a different set of characters. See [http://www.javascripter.net/faq/escape.htm this article] and [http://xkr.us/articles/javascript/encode-compare/ this article] for more information and comparisons.
<lang javascript>var normal = 'http://foo/bar/';
var encoded = encodeURIComponent(normal);</lang>
 
=={{header|Perl}}==
Anonymous user