bundles/org.apache.jasper.glassfish/src/org/apache/jasper/compiler/ParserController.java
private void comparePageEncodings(String jspConfigPageEnc)
            throws JasperException {

        if (jspConfigPageEnc == null) {
            return;
        }

        if (isXml && isEncodingSpecifiedInProlog) {
            /*
             * Make sure the encoding specified in the XML prolog matches
             * that in the JSP config element, treating "UTF-16", "UTF-16BE",
             * and "UTF-16LE" as identical.
             */
            if (!jspConfigPageEnc.equalsIgnoreCase(sourceEnc)
                    && (!jspConfigPageEnc.toLowerCase().startsWith("utf-16")
                        || !sourceEnc.toLowerCase().startsWith("utf-16"))) {
                err.jspError("jsp.error.prolog_config_encoding_mismatch",
                             sourceEnc, jspConfigPageEnc);
            }
        }

        if (hasBom) {
            /*
             * Make sure the encoding specified in the BOM matches
             * that in the JSP config element, treating "UTF-16", "UTF-16BE",
             * and "UTF-16LE" as identical.
             */
            if (!jspConfigPageEnc.equalsIgnoreCase(sourceEnc)
                    && (!jspConfigPageEnc.toLowerCase().startsWith("utf-16")
                        || !sourceEnc.toLowerCase().startsWith("utf-16"))) {
                err.jspError("jsp.error.bom_config_encoding_mismatch",
                             sourceEnc, jspConfigPageEnc);
            }
        }
    }
private void comparePageEncodings(String jspConfigPageEnc)
            throws JasperException {

        if (jspConfigPageEnc == null) {
            return;
        }

        if (isXml && isEncodingSpecifiedInProlog) {
            /*
             * Make sure the encoding specified in the XML prolog matches
             * that in the JSP config element, treating "UTF-16", "UTF-16BE",
             * and "UTF-16LE" as identical.
             */
            if (!jspConfigPageEnc.equalsIgnoreCase(sourceEnc)
                    && (!jspConfigPageEnc.toLowerCase().startsWith("utf-16")
                        || !sourceEnc.toLowerCase().startsWith("utf-16"))) {
                err.jspError("jsp.error.prolog_config_encoding_mismatch",
                             sourceEnc, jspConfigPageEnc);
            }
        }

        if (hasBom) {
            /*
             * Make sure the encoding specified in the BOM matches
             * that in the JSP config element, treating "UTF-16", "UTF-16BE",
             * and "UTF-16LE" as identical.
             */
            if (!jspConfigPageEnc.equalsIgnoreCase(sourceEnc)
                    && (!jspConfigPageEnc.toLowerCase().startsWith("utf-16")
                        || !sourceEnc.toLowerCase().startsWith("utf-16"))) {
                err.jspError("jsp.error.bom_config_encoding_mismatch",
                             sourceEnc, jspConfigPageEnc);
            }
        }
    }
/*
Ensures that the page encoding specified in the JSP config element
(with matching URL pattern), if present, matches the page encoding
specified in the XML prolog of a JSP document (XML syntax) and the
page encoding derived from the BOM.

@param jspConfigPageEnc Page encoding specified in JSP config element

@throws JasperException if page encoding mismatch