public static String htmlq(String html) {
        if (html == null)
            return ("(null)");
        StringBuilder buf = new StringBuilder();
        for (int i = 0; i < html.length(); i++) {
            char c = html.charAt(i);
            if (c == '&')
                buf.append("&amp;");
            else if (c == '<')
                buf.append("&lt;");
            else if (c == '>')
                buf.append("&gt;");
            else
                buf.append(c);
        }
        return (buf.toString());
    }