def __tidy(self, content): tidy = Tidy() tidy.setIndentAttributes(False) tidy.setIndentContent(False) tidy.setPrintBodyOnly(True) tidy.setSmartIndent(False) tidy.setWraplen(0) tidy.setXHTML(True) tidy.setNumEntities(True) tidy.setShowWarnings(False) tidy.setQuiet(True) out = ByteArrayOutputStream() tidy.parse(IOUtils.toInputStream(content, "UTF-8"), out) return out.toString("UTF-8")