GWT HtmlPanel filled with nbsp; characters (GWT SafeHTML?)

I am using GWT 2.5 in one of my new projects and ran into a small obstacle. In previous versions of GWT, SafeHTML was disabled for the HTMLPanel, which meant that if I placed a large block of text in the HTMLPanel, it would react like normal HTML, all double + spaces would be removed and all new lines would be removed. As of GWT 2.5 all my spaces are replaced with nbsp; and long lines end up on screen ignoring all my CSS rules

<ui:style>
    .justify {
        text-align: justify;    
    }
</ui:style>
<g:HTMLPanel styleName="{style.justify}">

LARGE BLOCK OF TEXT THAT 
SOMETIMES GOES FAR OUT OF MY IDE AND OTHER TIMES
ONLY DO
THIS

</g:HTMLPanel>

      

The above example in GWT 2.4 (obviously justified) would look like this:

LARGE BLOCK OF TEXT THAT 
SOMETIMES GOES FAR OUT OF 
MY IDE AND OTHER TIME 
ONLY DO THIS

      

In GWT2.5, the above example would look like this (with all spaces replaced with "& nbsp;", causing it to overflow its container even with wordwrap enabled):

LARGE BLOCK OF TEXT THAT 
SOMETIMES GOES FAR OUT OF MY IDE AND OTHER TIMES
ONLY DO
THIS

      

Any idea on how to disable SafeHTML in GWT 2.5 for HTMLPanels or any alternative ideas on how I can put "natural HTML" inside my page, without replacing spaces with "& nbsp;"

+3


source to share


1 answer


Got a response from google support after logging the bug that said he couldn't reproduce the problem I was facing and suggested that I see what spaces my code was in (something very obvious that I never thought about). It turns out that my IDE for some strange reason adds spaces like U + 00A0 instead of U + 0020, which is then converted to nbsp;



So if you see nbsp; in your view, see what types of spaces the IDE embeds. Many thanks to Google Support for pointing this out!

+1


source







All Articles