Here you can find the source of toCharacter(String str, String charset)
public static String toCharacter(String str, String charset)
//package com.java2s; //License from project: Apache License public class Main { public static String toCharacter(String str, String charset) { if (str != null && !str.equals("")) { try { return new String(str.getBytes("ISO8859-1"), charset); } catch (Exception var3) { var3.printStackTrace(); return ""; }//w w w .ja v a 2s . co m } else { return ""; } } public static boolean equals(String str1, String str2) { return str1 != null && !str1.equals("") && str2 != null && !str2.equals("") ? str1.equals(str2) : false; } }