@Override
    public void characters(char[] chars, int start, int length) throws SAXException {
        int end = start + length;
        for (int i = start; i < end; i++) {
            char c = chars[i];
            if (!((c >= '\u0020' && c <= '\uFFFD') || c == '\t' || c == '\n' || c == '\r') || c == '\uFEFF' || (c >= '\u007F' && c <= '\u009F') || (c >= '\uFDD0' && c <= '\uFDDF')) {
                if (start < i) {
                    super.characters(chars, start, i - start);
                }
                super.characters(REPLACEMENT_CHARACTER, 0, 1);
                start = i + 1;
            }
        }
        if (start < end) {
            super.characters(chars, start, end - start);
        }
    }
@see nu.validator.xml.ContentHandlerFilter#characters(char[], int, int)
src/nu/validator/xml/ForbiddenCharacterFilter.java