Java tutorial
//package com.java2s; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; public class Main { public static String urlEncode(String input) { return urlEncode(input, "UTF-8"); } public static String urlEncode(String input, String charset) { try { return URLEncoder.encode(input, charset); } catch (UnsupportedEncodingException e) { return input; } } }