Java tutorial
//package com.java2s; import java.net.URLEncoder; public class Main { public static String formatUrlForDownload(String srcurl) { String dsturl = "" + srcurl; if (null != srcurl) { dsturl = URLEncoder.encode(srcurl).replace("%3A", ":").replace("%2F", "/").replace("%3D", "=") .replace("+", "%20"); } return dsturl; } }