Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ed 20 posts 40 karma points
    May 17, 2010 @ 20:38
    Ed
    0

    umbraco.library:StripHtml - doesn't strip  

    Title says it all.  I use StripHtml for news items.  Noticed that it doesn't strip out    Would prefer that it replaced with actual space in returned string.

    To see this, go to http://sandiegodatapro.com/news.aspx and look at the end of the text for the 'Our New Site' news item.

    Umbraco 4.03

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    May 17, 2010 @ 21:10
    Jan Skovgaard
    0

    Hi Ed

    I'm not really sure if this is a bug.

    But if you think it is I think you should post it on codeplex - http://umbraco.codeplex.com/workitem/list/basic

    To fix the issue I think you can replace the   etc. using the Replace function in the umbracol.library.

    /Jan

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    May 17, 2010 @ 21:11
    Dirk De Grave
    0

    Ed,

    isn't that because you're first truncating the string, then performing a stripHtml?

     

    Cheers,

    /Dirk

  • Ed 20 posts 40 karma points
    May 17, 2010 @ 21:58
    Ed
    0

    Dirk,

    I used the Runway FAQ sample and it does the Strip first, then the truncate. 

    <xsl:value-of select="umbraco.library:TruncateString(umbraco.library:StripHtml(data [@alias = 'NewsContent']), number($excerptLength), '...')" disable-output-escaping="yes"/>

    But you were on the right track.  It looks like the first character to be truncated is the ';', so the browser won't make the remaining &nbsp into a space.

    It would be easier if the StripHtml method took care of this up front.

    I'll leave it up to the developers as to whether they think it's a bug.  I would consider &nbsp; and similar things to be mark up and hence you would want to strip them out with the rest of the markup.  It is definitely unexpected behaviour to me.

    I've reported it here, in the bugs forum, shouldn't need to go to codeplex as well.

    Thanks.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    May 17, 2010 @ 22:29
    Jan Skovgaard
    0

    Hi Ed

    Well I don't disagree with you. It should be enough to post bugs in ONE place. But I specifically asked whether to post bugs in here or on codeplex and the answer was codeplex. I guess it's easier for the core team to prioritize bugs etc. based on the voting in there.

    So I really think you should post it in there :-)

    /Jan

  • John Walker 43 posts 66 karma points
    Jan 17, 2011 @ 23:12
    John Walker
    1

    I came across this issue today was a bizarre one. When I firebugged the actual content being rendered it was on double spaces and the actual html being rendered was &nbsp;

    I just did I replace on this and that seems to work ok as a work around.

    umbraco.library:TruncateString(umbraco.library:Replace(umbraco.library:StripHtml(./introduction),'&amp;nbsp;',' '), 255,'...')

    John

Please Sign in or register to post replies

Write your reply to:

Draft