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