public static boolean useUTF8(){
  try {
    System.setOut(new PrintStream(System.out,true,"UTF8"));
    System.setErr(new PrintStream(System.err,true,"UTF8"));
    return true;
  }
 catch (  UnsupportedEncodingException e1) {
    LOG.warn("UTF8 is not a valid encoding; using system default encoding for System.out and System.err.");
    return false;
  }
catch (  SecurityException e2) {
    LOG.warn("Security manager is configured to disallow changes to System.out or System.err; using system default encoding.");
    return false;
  }
}

public static boolean useUTF8 ( ) { try { System . setOut ( new PrintStream ( System . out , true , "UTF8" ) ) ; System . setErr ( new PrintStream ( System . err , true , "UTF8" ) ) ; return true ; } catch ( UnsupportedEncodingException e1 ) { LOG . warn ( "UTF8 is not a valid encoding; using system default encoding for System.out and System.err." ) ; return false ; } catch ( SecurityException e2 ) { LOG . warn ( "Security manager is configured to disallow changes to System.out or System.err; using system default encoding." ) ; return false ; } }
set system . out and system . err to use the utf8 character encoding .
