Here you can find the source of encodeParameters(Map
private static String encodeParameters(Map<String, String> params, String paramsEncoding)
//package com.java2s; //License from project: Apache License import java.io.*; import java.net.URLEncoder; import java.util.Map; public class Main { private static String encodeParameters(Map<String, String> params, String paramsEncoding) { StringBuilder encodedParams = new StringBuilder(); try {//from w w w . j a va 2 s.com for (Map.Entry<String, String> entry : params.entrySet()) { encodedParams.append(URLEncoder.encode(entry.getKey(), paramsEncoding)); encodedParams.append('='); encodedParams.append(URLEncoder.encode(entry.getValue(), paramsEncoding)); encodedParams.append('&'); } return encodedParams.delete(encodedParams.length() - 1, encodedParams.length()).toString(); } catch (UnsupportedEncodingException uee) { throw new RuntimeException("Encoding not supported: " + paramsEncoding, uee); } } }