Here you can find the source of urlEncode(String url, Charset cs)
public static String urlEncode(String url, Charset cs)
//package com.java2s; //License from project: Apache License import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.nio.charset.Charset; public class Main { public static String urlEncode(String url, Charset cs) { try {/*from w ww.ja va2 s .com*/ return URLEncoder.encode(url, cs.name()); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } } }