Java tutorial
//package com.java2s; import java.net.URLEncoder; public class Main { public static String getEncoderStr(String str) { String utfStr; try { utfStr = URLEncoder.encode(str, "utf-8").replace("+", "%20"); } catch (Exception e) { utfStr = str; } return utfStr; } }