Here you can find the source of encodeUriComponent(String value)
public static String encodeUriComponent(String value)
//package com.java2s; //License from project: Open Source License import java.io.UnsupportedEncodingException; import java.net.URLEncoder; public class Main { public static String encodeUriComponent(String value) { try {/*from w w w . ja va 2 s.c om*/ return convertToGAStyleEncoding(URLEncoder.encode(value, "UTF-8")); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } } public static String convertToGAStyleEncoding(String urlEncodedString) { return urlEncodedString.replace("+", "%20").replace("%21", "!").replace("%2A", "*").replace("%27", "'") .replace("%28", "(").replace("%29", ")"); } }