From 44c8b286a6dec88cb6eaa973836be53a3d44da47 Mon Sep 17 00:00:00 2001 From: ray Date: Fri, 18 Mar 2005 00:04:51 +0000 Subject: [PATCH] Un-entify our entified characters prior to entifying them so that if text is passed through the filter repeatedly it won't continually expand the ampersands until an ugly thing remains. git-svn-id: https://samskivert.googlecode.com/svn/trunk@1624 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- .../src/java/com/samskivert/servlet/util/HTMLUtil.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/projects/samskivert/src/java/com/samskivert/servlet/util/HTMLUtil.java b/projects/samskivert/src/java/com/samskivert/servlet/util/HTMLUtil.java index e7458c1d..7df37fc0 100644 --- a/projects/samskivert/src/java/com/samskivert/servlet/util/HTMLUtil.java +++ b/projects/samskivert/src/java/com/samskivert/servlet/util/HTMLUtil.java @@ -39,10 +39,18 @@ public class HTMLUtil { // this could perhaps be done more efficiently, but this function // is not likely to be called on large quantities of text + // (first we turn the entified versions normal so that if text is + // repeatedly run through this it doesn't keep changing successive + // &'s into "&". + text = StringUtil.replace(text, """, "\""); + text = StringUtil.replace(text, ">", ">"); + text = StringUtil.replace(text, "<", "<"); + text = StringUtil.replace(text, "&", "&"); text = StringUtil.replace(text, "&", "&"); text = StringUtil.replace(text, "<", "<"); text = StringUtil.replace(text, ">", ">"); - return StringUtil.replace(text, "\"", """); + text = StringUtil.replace(text, "\"", """); + return text; } /**