void writeNormalizedChars(
        final char ch[],
            final int start,
            final int length,
            final boolean useLineSep)
            throws IOException, org.xml.sax.SAXException 
    {
        final String encoding = getEncoding();
        final java.io.Writer writer = m_writer;
        final int end = start + length;

        /* copy a few "constants" before the loop for performance */
        final char S_LINEFEED = CharInfo.S_LINEFEED;

        // This for() loop always increments i by one at the end
        // of the loop.  Additional increments of i adjust for when
        // two input characters (a high/low UTF16 surrogate pair)
        // are processed.
        for (int i = start; i < end; i++) {
            final char c = ch[i];

            if (S_LINEFEED == c && useLineSep) {
                writer.write(m_lineSep, 0, m_lineSepLen);
                // one input char processed
            } else if (m_encodingInfo.isInEncoding(c)) {
                writer.write(c);
                // one input char processed    
            } else if (Encodings.isHighUTF16Surrogate(c)) {
                final int codePoint = writeUTF16Surrogate(c, ch, i, end);
                if (codePoint != 0) {
                    // I think we can just emit the message,
                    // not crash and burn.
                    final String integralValue = Integer.toString(codePoint);
                    final String msg = Utils.messages.createMessage(
                        MsgKey.ER_ILLEGAL_CHARACTER,
                        new Object[] { integralValue, encoding });
                      
                    //Older behavior was to throw the message,
                    //but newer gentler behavior is to write a message to System.err
                    //throw new SAXException(msg);
                    System.err.println(msg);                            

                }
                i++; // two input chars processed               
            } else {
                // Don't know what to do with this char, it is
                // not in the encoding and not a high char in
                // a surrogate pair, so write out as an entity ref
                if (encoding != null) {
                    /* The output encoding is known, 
                     * so somthing is wrong.
                     */

                    // not in the encoding, so write out a character reference
                    writer.write('&');
                    writer.write('#');
                    writer.write(Integer.toString(c));
                    writer.write(';');

                    // I think we can just emit the message,
                    // not crash and burn.
                    final String integralValue = Integer.toString(c);
                    final String msg = Utils.messages.createMessage(
                        MsgKey.ER_ILLEGAL_CHARACTER,
                        new Object[] { integralValue, encoding });
                      
                    //Older behavior was to throw the message,
                    //but newer gentler behavior is to write a message to System.err
                    //throw new SAXException(msg);
                    System.err.println(msg); 
                } else {
                    /* The output encoding is not known,
                     * so just write it out as-is.
                     */
                    writer.write(c);
                }

                // one input char was processed
            }
        }
    }
void writeNormalizedChars ( final char ch [ ] , final int start , final int length , final boolean useLineSep ) throws IOException , org . xml . sax . SAXException { final String encoding = getEncoding ( ) ; final java . io . Writer writer = m_writer ; final int end = start + length ; final char S_LINEFEED = CharInfo . S_LINEFEED ; for ( int i = start ; i < end ; i ++ ) { final char c = ch [ i ] ; if ( S_LINEFEED == c && useLineSep ) { writer . write ( m_lineSep , 0 , m_lineSepLen ) ; } else if ( m_encodingInfo . isInEncoding ( c ) ) { writer . write ( c ) ; } else if ( Encodings . isHighUTF16Surrogate ( c ) ) { final int codePoint = writeUTF16Surrogate ( c , ch , i , end ) ; if ( codePoint != 0 ) { final String integralValue = Integer . toString ( codePoint ) ; final String msg = Utils . messages . createMessage ( MsgKey . ER_ILLEGAL_CHARACTER , new Object [ ] { integralValue , encoding } ) ; System . err . println ( msg ) ; } i ++ ; } else { if ( encoding != null ) { writer . write ( '&' ) ; writer . write ( '#' ) ; writer . write ( Integer . toString ( c ) ) ; writer . write ( ';' ) ; final String integralValue = Integer . toString ( c ) ; final String msg = Utils . messages . createMessage ( MsgKey . ER_ILLEGAL_CHARACTER , new Object [ ] { integralValue , encoding } ) ; System . err . println ( msg ) ; } else { writer . write ( c ) ; } } } }
Normalize the characters, but don't escape.  Different from
SerializerToXML#writeNormalizedChars because it does not attempt to do
XML escaping at all.

@param ch The characters from the XML document.
@param start The start position in the array.
@param length The number of characters to read from the array.
@param useLineSep true if the operating systems
end-of-line separator should be output rather than a new-line character.

@throws IOException
@throws org.xml.sax.SAXException