private void character(char ch) throws IOException {

        if (ch <= 0xff) {
            // In single byte characters, replace only the five
            // characters for which well-known entities exist in XML
            if (ch == 0x22) {
                writer.write("&quot;");
            } else if (ch == 0x26) {
                writer.write("&amp;");
            } else if (ch == 0x27) {
                writer.write("&apos;");
            } else if (ch == 0x3C) {
                writer.write("&lt;");
            } else if (ch == 0X3E) {
                writer.write("&gt;");
            } else {
                writer.write(ch);
            }
        } else {
            if (substitution()) {
                numeric(writer, ch);
            } else {
                writer.write(ch);
            }
        }

    }