Java tutorial
//package com.java2s; import java.net.URLEncoder; import java.io.UnsupportedEncodingException; public class Main { public static final String encode(String content) { try { return content == null ? null : URLEncoder.encode(content, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } } }