Here you can find the source of escape(final String s)
public static String escape(final String s)
//package com.java2s; //License from project: Open Source License import java.io.UnsupportedEncodingException; import java.net.URLEncoder; public class Main { public static String escape(final String s) { try {//from ww w. j av a 2 s . c om return URLEncoder.encode(s, "UTF-8"); } catch (UnsupportedEncodingException e) { return s; } } }