Here you can find the source of toUtf8(String texto)
public static String toUtf8(String texto)
//package com.java2s; //License from project: Apache License public class Main { public static String toUtf8(String texto) { try {//from w w w . ja va 2 s. c o m return new String(texto.getBytes(), "UTF-8"); } catch (Exception e) { return ""; } } }