Here you can find the source of toUTF8(String str)
public static String toUTF8(String str)
//package com.java2s; //License from project: Apache License import java.io.UnsupportedEncodingException; public class Main { public static String toUTF8(String str) { if (!isNull(str)) { try { str = new String(str.getBytes("ISO8859-1"), "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace();/*from w w w.ja v a 2s.com*/ } } return str; } public static boolean isNull(String str) { if (null == str || str.length() == 0) { return true; } else { return false; } } }