private void draconianInputStreamReader(String encoding,
            InputStream stream, boolean requireAsciiSuperset, String actualName)
            throws SAXException, IOException {
        // method added -- 2005-08-21 hsivonen
        // revised -- 2008-03-17 hsivonen
        sourceType = INPUT_READER;
        characterEncoding = Encoding.toAsciiLowerCase(actualName);
        encoding = Encoding.toAsciiLowerCase(encoding);
        try {
            Encoding cs = Encoding.forName(encoding);
            String canonName = cs.getCanonName();
            if (requireAsciiSuperset) {
                if (!cs.isAsciiSuperset()) {
                    fatal("The encoding \u201C"
                            + actualName
                            + "\u201D is not an ASCII superset and, therefore, cannot be used in an internal encoding declaration.");
                }
            }
            if (!cs.isRegistered()) {
                if (encoding.startsWith("x-")) {
                    err("The encoding \u201C"
                            + actualName
                            + "\u201D is not an IANA-registered encoding. (Charmod C022)");                    
                } else {
                    err("The encoding \u201C"
                            + actualName
                            + "\u201D is not an IANA-registered encoding and did not use the \u201Cx-\u201D prefix. (Charmod C023)");
                }
            } else if (!canonName.equals(encoding)) {
                err("The encoding \u201C"
                        + actualName
                        + "\u201D is not the preferred name of the character encoding in use. The preferred name is \u201C"
                        + canonName + "\u201D. (Charmod C024)");
            }
            if (!("utf-8".equals(encoding) || "utf-16".equals(encoding)
                    || "utf-16be".equals(encoding)
                    || "utf-16le".equals(encoding)
                    || "iso-8859-1".equals(encoding) || "us-ascii".equals(encoding))) {
                handler.warn("XML processors are required to support the UTF-8 and UTF-16 character encodings. The encoding was \u201C"
                        + actualName
                        + "\u201D instead, which is an incompatibility risk.");
            }
            Encoding htmlActual = cs.getActualHtmlEncoding();
            if (htmlActual != null) {
                handler.warn("Documents encoded as \u201C"
                        + htmlActual.getCanonName()
                        + "\u201D are often mislabeled as \u201C"
                        + actualName
                        + "\u201D, which is the declared encoding of this document.");
            }
            CharsetDecoder decoder = cs.newDecoder();
            decoder.onMalformedInput(CodingErrorAction.REPORT);
            decoder.onUnmappableCharacter(CodingErrorAction.REPORT);
            this.reader = new InputStreamReader(stream, decoder);
        } catch (UnsupportedCharsetException e) {
            fatal("Unsupported character encoding \u201C" + actualName
                    + "\u201D.");
        }
    }
Parse a text declaration.

<pre>
 [79] TextDecl ::= '&lt;?xml' VersionInfo? EncodingDecl S? '?&gt;'
 [80] EncodingDecl ::= S 'encoding' Eq
    ( '&quot;' EncName '&quot;' | &quot;'&quot; EncName &quot;'&quot; )
 [81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')*
</pre>

<p>
(The <code>&lt;?xml</code>' and whitespace have already been read.)

@return the encoding in the declaration, uppercased; or null
@see #parseXMLDecl
@see #setupDecoding
src/nu/validator/gnu/xml/aelfred2/XmlParser.java