diff --git a/core/src/main/java/hudson/Util.java b/core/src/main/java/hudson/Util.java index 199c05af64..4b6c3cc6da 100644 --- a/core/src/main/java/hudson/Util.java +++ b/core/src/main/java/hudson/Util.java @@ -456,6 +456,14 @@ public class Util { else if(ch=='&') buf.append("&"); + else + if(ch==' ') { + // All spaces in a block of consecutive spaces are converted to + // non-breaking space ( ) except for the last one. This allows + // significant whitespace to be retained without prohibiting wrapping. + char nextCh = i+1 < text.length() ? text.charAt(i+1) : 0; + buf.append(nextCh==' ' ? " " : " "); + } else buf.append(ch); }