Java tutorial
//package com.java2s; import android.util.Log; import java.net.URLEncoder; public class Main { public static String toURLEncoded(String paramString) { if (paramString == null || paramString.equals("")) { Log.d("h", "toURLEncoded error:" + paramString); return ""; } try { String str = new String(paramString.getBytes(), "UTF-8"); str = URLEncoder.encode(str, "UTF-8"); return str; } catch (Exception localException) { Log.d("h", "toURLEncoded error:" + paramString, localException); } return ""; } }