From 02d3803c4c863820741c7270d193bfa8e6a4f423 Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 2 Mar 2020 16:50:17 +0100 Subject: [PATCH] Escape edit as plain text --- app/src/main/java/eu/faircode/email/FragmentCompose.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index 398f60db2e..fbb7354001 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -870,8 +870,11 @@ public class FragmentCompose extends FragmentBase { Document document = JsoupEx.parse(body); if (plain) { String text = HtmlHelper.getText(ref.outerHtml()); + String[] line = text.split("\\r?\\n"); + for (int i = 0; i < line.length; i++) + line[i] = Html.escapeHtml(line[i]); Element p = document.createElement("p"); - p.html(text.replaceAll("\\r?\\n", "
")); + p.html(TextUtils.join("
", line)); document.body().appendChild(p); } else { Document d = HtmlHelper.sanitize(context, ref.outerHtml(), true, false);