// 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.io.UnsupportedEncodingException;
import java.net.URLEncoder;

public class Enc {
    public static void main(String[] args) throws Exception {
        System.out.println(URLEncoder.encode("Æ Ø Å+", "UTF-8"));
        System.out.println(specialEncode("Æ Ø Å+"));
    }
    public static String specialEncode(String s) throws UnsupportedEncodingException {
        return URLEncoder.encode(s, "UTF-8").replaceAll("\\+", "%20");
    }
}
