protected boolean isInvalid(int ch) {
        if (ch < 0x20) {
            return ch != 0x09 && ch != 0x0A && ch != 0x0D;
        } else if (ch < 0xE000) {
            return ch > 0xD7FF;
        } else if (ch < 0x10000) {
            return ch > 0xFFFD;
        } else {
            return ch > 0x10FFFF;
        }
    }
Checks whether the given Unicode character is an invalid XML character
and should be replaced for output. Subclasses can override this method
to use an alternative definition of which characters should be replaced
in the XML output. The default definition from the XML specification is:
<pre>
Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
</pre>

@param ch character
@return <code>true</code> if the character should be replaced,
<code>false</code> otherwise
tika-core/src/main/java/org/apache/tika/sax/SafeContentHandler.java