code: private static boolean isAllowed(char c, String allow) {
          return (c >= 'A' && c <= 'Z')
                  || (c >= 'a' && c <= 'z')
                  || (c >= '0' && c <= '9')
                  || "_-!.~'()*".indexOf(c) != NOT_FOUND
                  || (allow != null && allow.indexOf(c) != NOT_FOUND);
      }
docs: Returns true if the given character is allowed.
  
  @param c     character to check
  @param allow characters to allow
  @return true if the character is allowed or false if it should be
  encoded