Copied to clipboard

Flag this post as spam?

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


  • Nis Wilson Nissen 4 posts 24 karma points
    Dec 09, 2010 @ 12:20
    Nis Wilson Nissen
    0

    Umbraco appends an extra newline character on macro parameters

    Hi,

    I have encountered at rather annoying problem with the rendering of a .Net user-control hosted inside an umbraco page (as a macro).

    When I render my user-control on a vanilla .aspx page it works fine.

    When I render the same user-control via a macro on a umbraco page the rendered html and javascript is not the same and I get javascript errors because the parameters passed by umbraco now contains a newline character at the end, thus breaking my javascript string literals.

    The user-control is inserted and configured via the rich-text editor.

    I can probably make a work-around by trimming all macro values, but it would be nice if umbraco did not append the extra newline character.

    Is this a known issue and are there other workarounds?

    If someone knows where in the source code it might happen I will take a look at it and try to come up with a patch.

    Cheers,
    Nis

  • Nis Wilson Nissen 4 posts 24 karma points
    Dec 09, 2010 @ 12:45
    Nis Wilson Nissen
    0

    Aargg ... it is not umbraco playing tricks on me, but rather the richtext editor.

    Viewing the html inside the richtext editor reveals a number of \r\n characters inserted inside the macro parameter values.

    Removing them and saving just re-inserts them.

    I guess the richtext editor is not always the best way to "host" your macros.

    Again, does anybody have a good work-around for this issue?

    Cheers,
    Nis

  • Bjørn Fridal 274 posts 784 karma points
    Dec 10, 2010 @ 10:46
    Bjørn Fridal
    0

    Hi Nils,

    I just encountered the same problem and it seems we are not alone: http://our.umbraco.org/forum/developers/xslt/3240-dreaded-rn-has-re-appeared?p=3

    I managed with a replace, as a workaround:

    text = text.Replace("\r\n", "")
  • Josh Reid 182 posts 257 karma points
    Feb 18, 2011 @ 22:32
    Josh Reid
    0

    Hey all...

    I have found it successful to set the use of Tidy in umbracoSettings.config to false.

    <!-- clean editor content with use of tidy -->
    <TidyEditorContent>False</TidyEditorContent>

    This removes the offending /r/n characters from macro parameters.

    BEWARE: Removing TIDY from RTE makes it possible for editor to place all kinds of weird and outdated HTML elements in the RTE field, which could also be invalid and therefore in worst case break a page layout.

    I guess though it is a solution, many do come with knock on effects... Use with caution.

    Cheers
    Josh

Please Sign in or register to post replies

Write your reply to:

Draft