Java tutorial
//package com.java2s; import java.io.UnsupportedEncodingException; public class Main { private static String UTF_8 = "UTF-8"; public static String utf8Encoding(String value, String sourceCharsetName) { try { return new String(value.getBytes(sourceCharsetName), UTF_8); } catch (UnsupportedEncodingException e) { throw new IllegalArgumentException(e); } } }