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