Java tutorial
//package com.java2s; import java.net.URLEncoder; public class Main { public static String getEncodedString(String toEncode) throws Exception { if (toEncode == null) return ""; return URLEncoder.encode(toEncode, "utf-8"); } }