Java tutorial
//package com.java2s; import java.io.UnsupportedEncodingException; public class Main { public static String getUTFFromISO(String str) { try { if (str == null) str = ""; byte[] buf = str.getBytes("iso-8859-1"); byte[] buf2 = str.getBytes("UTF-8"); if (!str.equals(new String(buf2, "UTF-8"))) { str = new String(buf, "UTF-8"); } return str; } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return str; } }