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