code: private void checkEncodingLiteral(String encodingName) throws SAXException {
          if (encodingName == null) {
              return;
          }
          if (encodingName.length() == 0) {
              fatal("The empty string does not a legal encoding name.");
          }
          char c = encodingName.charAt(0);
          if (!(((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')))) {
              fatal("The encoding name must start with an ASCII letter.");
          }
          for (int i = 1; i < encodingName.length(); i++) {
              c = encodingName.charAt(i);
              if (!(((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z'))
                      || ((c >= '0') && (c <= '9')) || (c == '.') || (c == '_') || (c == '-'))) {
                  fatal("Illegal character in encoding name: U+"
                          + Integer.toHexString(c) + ".");
              }
          }
      }
docs: hsivonen 2006-04-28