URL decoding: Difference between revisions
Content deleted Content added
added objective-c |
added java |
||
Line 80: | Line 80: | ||
Note that a minor efficiency improvement is possible, by eliminating duplicated escape codes: |
Note that a minor efficiency improvement is possible, by eliminating duplicated escape codes: |
||
<lang j>urldecode=: rplc&(~.,/;"_1&a."2(,:tolower)'%',.hfd i.#a.)</lang> |
<lang j>urldecode=: rplc&(~.,/;"_1&a."2(,:tolower)'%',.hfd i.#a.)</lang> |
||
=={{header|Java}}== |
|||
<lang java>import java.io.UnsupportedEncodingException; |
|||
import java.net.URLDecoder; |
|||
public class Main |
|||
{ |
|||
public static void main(String[] args) throws UnsupportedEncodingException |
|||
{ |
|||
String encoded = "http%3A%2F%2Ffoo%20bar%2F"; |
|||
String normal = URLDecoder.decode(encoded, "utf-8"); |
|||
System.out.println(normal); |
|||
} |
|||
}</lang> |
|||
Output: |
|||
<pre>http://foo bar/</pre> |
|||
=={{header|NetRexx}}== |
=={{header|NetRexx}}== |