From 810dab5ea22a48555058d4612ff10f8b8ecbdf08 Mon Sep 17 00:00:00 2001 From: Mathieu Baudier Date: Tue, 26 Jan 2021 10:02:04 +0100 Subject: [PATCH] Temporary fix to prevent XML forbidden characters crashing the UI. --- .../org/argeo/docbook/ui/DbkTextInterpreter.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/publishing/org.argeo.publishing.ui/src/org/argeo/docbook/ui/DbkTextInterpreter.java b/publishing/org.argeo.publishing.ui/src/org/argeo/docbook/ui/DbkTextInterpreter.java index 2717a38..eafddd9 100644 --- a/publishing/org.argeo.publishing.ui/src/org/argeo/docbook/ui/DbkTextInterpreter.java +++ b/publishing/org.argeo.publishing.ui/src/org/argeo/docbook/ui/DbkTextInterpreter.java @@ -88,6 +88,22 @@ public class DbkTextInterpreter implements TextInterpreter { public String readSimpleHtml(Item item) { String raw = raw(item); + // FIXME the saved data should be corrected instead. + if (raw.indexOf('&') >= 0) { + raw = raw.replace("&", "&"); + } + if (raw.indexOf('<') >= 0) { + raw = raw.replace("<", "<"); + } + if (raw.indexOf('>') >= 0) { + raw = raw.replace(">", ">"); + } + if (raw.indexOf('\"') >= 0) { + raw = raw.replace("\"", """); + } + if (raw.indexOf('\'') >= 0) { + raw = raw.replace("\'", "'"); + } // raw = "" + raw + ""; if (raw.length() == 0) return raw; -- 2.30.2