Here you can find the source of toUTF8(String str)
public static String toUTF8(String str)
//package com.java2s; //License from project: Apache License public class Main { public static String toUTF8(String str) { if (str != null && !str.equals("")) { try { return new String(str.getBytes("ISO8859-1"), "UTF-8"); } catch (Exception var2) { var2.printStackTrace(); return ""; }/*from w w w.j av a2 s . c om*/ } else { return ""; } } public static boolean equals(String str1, String str2) { return str1 != null && !str1.equals("") && str2 != null && !str2.equals("") ? str1.equals(str2) : false; } }