// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.net.URI;
import java.net.URLEncoder;

public class UrlEncodingFun {
    public static void test(String s) throws Exception {
        System.out.println(s + " " + URLEncoder.encode(s, "UTF-8") + " " + new URI( null, null, null, -1, null, s, null ).toString().substring(1));
    }
    public static void main(String[] args) throws Exception {
        for(int i = 32; i < 256; i++) {
            String s = new String(new char[] { 'x', (char) i });
        }
        test("a=b&c=d");
    }
}
