Java tutorial
//package com.java2s; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; public class Main { private final static String ENCODE = "UTF-8"; private static String urlEncode(String str) { try { //return URLEncoder.encode(str, ENCODE).replace("%2F", "/"); by wmh return URLEncoder.encode(str, ENCODE).replace("%2F", "/").replace("+", " "); } catch (UnsupportedEncodingException e) { return null; } } }