From: Artur Signell Date: Thu, 25 Aug 2011 14:40:01 +0000 (+0000) Subject: #7478 Util.escapeHtml incorrectly converts newline to
and space to " "... X-Git-Tag: 6.7.0.beta1~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1ec08dec729c799cccb6290e6afb507ba2740285;p=vaadin-framework.git #7478 Util.escapeHtml incorrectly converts newline to
and space to " " in IE6-IE8 svn changeset:20662/svn branch:6.7 --- diff --git a/src/com/vaadin/terminal/gwt/client/Util.java b/src/com/vaadin/terminal/gwt/client/Util.java index 7edad795fe..9d2f1d3968 100644 --- a/src/com/vaadin/terminal/gwt/client/Util.java +++ b/src/com/vaadin/terminal/gwt/client/Util.java @@ -248,7 +248,14 @@ public class Util { */ public static String escapeHTML(String html) { DOM.setInnerText(escapeHtmlHelper, html); - return DOM.getInnerHTML(escapeHtmlHelper); + String escapedText = DOM.getInnerHTML(escapeHtmlHelper); + if (BrowserInfo.get().isIE() && BrowserInfo.get().getIEVersion() < 9) { + // #7478 IE6-IE8 "incorrectly" returns "
" for newlines set using + // setInnerText. The same for " " which is converted to " " + escapedText = escapedText.replaceAll("<(BR|br)>", "\n"); + escapedText = escapedText.replaceAll(" ", " "); + } + return escapedText; } /**