docs: private Reader createReader(InputStream inputStream, String encoding,
  				Boolean isBigEndian)
                  throws IOException, JspCoreException {
  
          // normalize encoding name
          if (encoding == null) {
              encoding = "UTF-8";
          }
  
          // try to use an optimized reader
          String ENCODING = encoding.toUpperCase(Locale.ENGLISH);
          if (ENCODING.equals("UTF-8")) {
              return new UTF8Reader(inputStream, fBufferSize);
          }
          if (ENCODING.equals("US-ASCII")) {
              return new ASCIIReader(inputStream, fBufferSize);
          }
          if (ENCODING.equals("ISO-10646-UCS-4")) {
              if (isBigEndian != null) {
                  boolean isBE = isBigEndian.booleanValue();
                  if (isBE) {
                      return new UCSReader(inputStream, UCSReader.UCS4BE);
                  } else {
                      return new UCSReader(inputStream, UCSReader.UCS4LE);
                  }
              } else {
                  throw new JspCoreException("jsp.error.xml.encodingByteOrderUnsupported", new Object[] { encoding });
                  //err.jspError("jsp.error.xml.encodingByteOrderUnsupported",
  			    // encoding);
              }
          }
          if (ENCODING.equals("ISO-10646-UCS-2")) {
              if (isBigEndian != null) { // sould never happen with this encoding...
                  boolean isBE = isBigEndian.booleanValue();
                  if (isBE) {
                      return new UCSReader(inputStream, UCSReader.UCS2BE);
                  } else {
                      return new UCSReader(inputStream, UCSReader.UCS2LE);
                  }
              } else {
                  throw new JspCoreException("jsp.error.xml.encodingByteOrderUnsupported", new Object[] { encoding });
                  //err.jspError("jsp.error.xml.encodingByteOrderUnsupported",
  			    // encoding);
              }
          }
  
          // check for valid name
          boolean validIANA = XMLChar.isValidIANAEncoding(encoding);
          boolean validJava = XMLChar.isValidJavaEncoding(encoding);
          if (!validIANA || (fAllowJavaEncodings && !validJava)) {
              encoding = "ISO-8859-1";
              throw new JspCoreException("jsp.error.xml.encodingDeclInvalid", new Object[] { encoding });
              //err.jspError("jsp.error.xml.encodingDeclInvalid", encoding);
              // NOTE: AndyH suggested that, on failure, we use ISO Latin 1
              //       because every byte is a valid ISO Latin 1 character.
              //       It may not translate correctly but if we failed on
              //       the encoding anyway, then we're expecting the content
              //       of the document to be bad. This will just prevent an
              //       invalid UTF-8 sequence to be detected. This is only
              //       important when continue-after-fatal-error is turned
              //       on. -Ac
          }
  
          // try to use a Java reader
          String javaEncoding = EncodingMap.getIANA2JavaMapping(ENCODING);
          if (javaEncoding == null) {
              if (fAllowJavaEncodings) {
              	javaEncoding = encoding;
              } else {
                  javaEncoding = "ISO8859_1";
                  throw new JspCoreException("jsp.error.xml.encodingDeclInvalid", new Object[] { encoding });
                  //err.jspError("jsp.error.xml.encodingDeclInvalid", encoding);
                  // see comment above.
              }
          }
          return new InputStreamReader(inputStream, javaEncoding);
  
      }