public static String toUTF8(String sStr){
  byte[] baBytes=sStr.getBytes();
  try {
    return new String(baBytes,"UTF-8");
  }
 catch (  Exception e) {
    e.printStackTrace();
    return new String(baBytes);
  }
}

public static String toUTF8 ( String sStr ) { byte [ ] baBytes = sStr . getBytes ( ) ; try { return new String ( baBytes , "UTF-8" ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; return new String ( baBytes ) ; } }
converts a string to utf - 8 encoding .
