private String searchCharSet(String[] items){
  String charset;
  StringBuffer sb=new StringBuffer();
  for (int i=items.length; i > 0; i--) {
    charset=searchCharSet(items,sb,i);
    if (charset.length() > 0) {
      return charset;
    }
    sb.setLength(0);
  }
  return "";
}

private String searchCharSet ( String [ ] items ) { String charset ; StringBuffer sb = new StringBuffer ( ) ; for ( int i = items . length ; i > 0 ; i -- ) { charset = searchCharSet ( items , sb , i ) ; if ( charset . length ( ) > 0 ) { return charset ; } sb . setLength ( 0 ) ; } return "" ; }
searches for a charset for a specified locale .
