public static boolean isValidIANAEncoding(String ianaEncoding){
  if (ianaEncoding != null) {
    int length=ianaEncoding.length();
    if (length > 0) {
      char c=ianaEncoding.charAt(0);
      if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) {
        for (int i=1; i < length; i++) {
          c=ianaEncoding.charAt(i);
          if ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z') && (c < '0' || c > '9')&& c != '.' && c != '_' && c != '-') {
            return false;
          }
        }
        return true;
      }
    }
  }
  return false;
}

public static boolean isValidIANAEncoding ( String ianaEncoding ) { if ( ianaEncoding != null ) { int length = ianaEncoding . length ( ) ; if ( length > 0 ) { char c = ianaEncoding . charAt ( 0 ) ; if ( ( c >= 'A' && c <= 'Z' ) || ( c >= 'a' && c <= 'z' ) ) { for ( int i = 1 ; i < length ; i ++ ) { c = ianaEncoding . charAt ( i ) ; if ( ( c < 'A' || c > 'Z' ) && ( c < 'a' || c > 'z' ) && ( c < '0' || c > '9' ) && c != '.' && c != '_' && c != '-' ) { return false ; } } return true ; } } } return false ; }
returns true if the encoding name is a valid iana encoding . this method does not verify that there is a decoder available for this encoding , only that the characters are valid for an iana encoding name .
