From 150e7d5669ade1164d0692c6842ea9dca1368324 Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 3 Nov 2020 09:12:41 +0100 Subject: [PATCH] Clear columns with non breaking spaces --- .../main/java/eu/faircode/email/HtmlHelper.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/src/main/java/eu/faircode/email/HtmlHelper.java b/app/src/main/java/eu/faircode/email/HtmlHelper.java index 739f1ef4f9..0c2646071b 100644 --- a/app/src/main/java/eu/faircode/email/HtmlHelper.java +++ b/app/src/main/java/eu/faircode/email/HtmlHelper.java @@ -833,6 +833,20 @@ public class HtmlHelper { // Tables // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table for (Element col : document.select("th,td")) { + // Clear columns with non breaking spaces + if (col.childNodeSize() == 1 && + col.childNode(0) instanceof TextNode) { + boolean nbsp = true; + String text = ((TextNode) col.childNode(0)).getWholeText(); + for (int i = 0; i < text.length(); i++) + if (text.charAt(i) != '\u00a0') { + nbsp = false; + break; + } + if (nbsp) + col.html(""); + } + // separate columns if (hasVisibleContent(col.childNodes())) if (col.nextElementSibling() != null)