@Test
void controlCharacters() throws Exception
{

    String htmlInput = "<p>\u0008</p>";
    Document document = this.cleaner.clean(new StringReader(htmlInput));
    String textContent =
        document.getElementsByTagName("p").item(0).getTextContent();
    assertEquals(" ", textContent);
    assertHTML(" ", "\u0008");
    htmlInput = "<p>&#8;</p>";
    document = this.cleaner.clean(new StringReader(htmlInput));
    // HtmlCleaner currently doesn't handle properly unicode characters: asking it to recognize them
    // involves that all entities will be escaped during the parsing and that's not what we want. So we
    // keep them encoded.
    // See https://sourceforge.net/p/htmlcleaner/bugs/221/
    textContent =
        document.getElementsByTagName("p").item(0).getTextContent();
    assertEquals("&#8;", textContent);
    assertHTML("<p>&#8;</p>", "&#8;");
    htmlInput = "<p foo=\"&#8;\">content</p>";
    document = this.cleaner.clean(new StringReader(htmlInput));
    // HtmlCleaner currently doesn't handle properly unicode characters: asking it to recognize them
    // involves that all entities will be escaped during the parsing and that's not what we want. So we
    // keep them encoded.
    textContent =
        document.getElementsByTagName("p").item(0).getAttributes().getNamedItem("foo").getTextContent();
    assertEquals("&#8;", textContent);
    assertHTML("<p foo=\"&#8;\">content</p>", "<p foo=\"&#8;\">content</p>");
}