Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#249 Incorrect line wrapping with …

open
nobody
None
5
2012-10-08
2011-06-29
Anonymous
No

The following program produces output with line wrapped inside xml entity.

    Tidy tidy = new Tidy();
    tidy.setRawOut(true);
    tidy.setAsciiChars(true);
    tidy.setFixBackslash(true);
    tidy.setHideComments(true);
    tidy.setXHTML(true);
    tidy.setInputEncoding("UTF-8");
    tidy.setOutputEncoding("UTF-8");
    tidy.setForceOutput(true);
    tidy.setWraplen(10);
    tidy.setErrout(new PrintWriter(new ByteArrayOutputStream(), false));

    String source ="<html><body><div>1234567&hellip;&lt;</div></body></html>";
    ByteArrayInputStream bais = new ByteArrayInputStream(source.getBytes("UTF-8"));
    Writer stringWriter = new StringWriter();
    tidy.parse(bais, stringWriter);
    System.out.println(stringWriter.toString());

This is the output:
<!DOCTYPE html
PUBLIC
"-//W3C//DTD
XHTML 1.0
Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content="HTML Tidy for Java (vers. 2009-12-01), see jtidy.sourceforge.net"/>
<br>
</head>
<body>


1234567…&
lt;

</body>
</html>

Discussion