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