Java tutorial
//package com.java2s; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; public class Main { /** * Hides the irritating declared exception. */ public static String encode(String value) { try { return URLEncoder.encode(value, "utf-8"); } catch (UnsupportedEncodingException ex) { throw new RuntimeException(ex); } } }