Here you can find the source of toUTF8(String oldStr)
public static final String toUTF8(String oldStr)
//package com.java2s; //License from project: Open Source License public class Main { public static final String toUTF8(String oldStr) { return conversion(oldStr, "utf-8"); }/*www. j ava2 s . c o m*/ private static final String conversion(String oldStr, String coding) { String newStr = ""; try { if (oldStr != null) { newStr = new String(oldStr.getBytes("ISO-8859-1"), coding); } } catch (Exception e) { e.printStackTrace(); } return newStr; } }