URL encoding: Difference between revisions

Line 76:
String normal = "http://foo bar/";
String encoded = URLEncoder.encode(normal, "utf-8");
System.out.println(encoded); // Prints: http%3A%2F%2Ffoo+bar%2F
}
}</lang>
 
Output:
 
<pre>http%3A%2F%2Ffoo+bar%2F</pre>
 
=={{header|Perl}}==