Added DelSp support

This commit is contained in:
M66B 2022-02-12 23:18:05 +01:00
parent 472b3c5408
commit b9db0f7405
2 changed files with 7 additions and 2 deletions

View File

@ -1891,7 +1891,7 @@ public class HtmlHelper {
}
// https://tools.ietf.org/html/rfc3676
static String flow(String text) {
static String flow(String text, boolean delsp) {
boolean continuation = false;
StringBuilder flowed = new StringBuilder();
String[] lines = text.split("\\r?\\n");
@ -1899,6 +1899,9 @@ public class HtmlHelper {
String line = lines[l];
lines[l] = null;
if (delsp && line.length() > 0)
line = line.substring(0, line.length() - 1);
if (continuation)
while (line.startsWith(">")) {
line = line.substring(1);

View File

@ -2917,8 +2917,10 @@ public class MessageHelper {
} else if (StandardCharsets.UTF_8.equals(cs))
result = CharsetHelper.utf8toW1252(result);
// https://datatracker.ietf.org/doc/html/rfc3676
if ("flowed".equalsIgnoreCase(h.contentType.getParameter("format")))
result = HtmlHelper.flow(result);
result = HtmlHelper.flow(result,
"yes".equalsIgnoreCase(h.contentType.getParameter("delsp")));
// https://www.w3.org/QA/2002/04/valid-dtd-list.html
if (result.length() > DOCTYPE.length()) {