Here you can find the source of encode(String src, String srcCode, String destCode)
public static String encode(String src, String srcCode, String destCode)
//package com.java2s; //License from project: Open Source License import java.io.UnsupportedEncodingException; import java.net.URLEncoder; public class Main { public static String encode(String src, String srcCode, String destCode) { try {// w ww . j av a 2s . co m byte[] strby = src.getBytes(srcCode); String dest = new String(strby, destCode); return dest; } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return null; } public static String encode(String str) { try { return URLEncoder.encode(str, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException("Broken VM does not support UTF-8"); } } }