Makefile added / pkg-config descriptor
[metux-java.git] / util / URLEncode.java
blob5aecc1b1506806b71cee4611be9bb81ebc01dea2
2 package org.de.metux.util;
4 public class URLEncode
6 public static String encode(String s)
8 // escape the % character at first
9 s = StrReplace.replace("%","%25", s);
11 // now the other chars
12 s = StrReplace.replace(":", "%3A",
13 StrReplace.replace("/", "%2F", s));
14 return s;
17 public static String decode(String s)
19 // System.err.println("decoding string: "+s);
21 return
22 StrReplace.replace("%3A", ":",
23 StrReplace.replace("%2F", "/",
24 StrReplace.replace("%25", "%", s)));