Copied to clipboard

Flag this post as spam?

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


  • Tom Maton 387 posts 660 karma points
    Jul 29, 2009 @ 17:35
    Tom Maton
    0

    dreaded \r\n has re-appeared

    Hi All,

    I have made an XSLT file which pulls through content entered into a macro parameter and pulled through into the XSLT.

    But it seems to be adding \r\n which are obviously line breaks in .NET so when they appear in the Macro Parameter type textMultiLine they dont appear they just put the text onto the next line which you would expect.

    Is anyone else still getting this problem in the latest Umbraco?

    Tom

     

  • Robert J. Bullock 386 posts 405 karma points
    Jul 29, 2009 @ 17:42
    Robert J. Bullock
    0

    Yep, I'm getting it to. Drove me nuts. I developed a User Control last night that sends an email. It worked great on my development server then wouldn't work on my production server. The reason? The Subject line, which is a macro parameter, was getting clobbered with the "\r\n" bug! 

  • Robert J. Bullock 386 posts 405 karma points
    Jul 29, 2009 @ 17:42
    Robert J. Bullock
    0

    FYI, since I'm using a User Control, there's no way to specify the datatype for any given property. 

  • Robert J. Bullock 386 posts 405 karma points
    Jul 29, 2009 @ 17:46
    Robert J. Bullock
    0

    Oh wait, yeah, I can. Duh. Sorry.

  • Tom Maton 387 posts 660 karma points
    Jul 29, 2009 @ 23:35
    Tom Maton
    0

    Thing is I am using an XSLT because it's just a sentence I want displayed and dont want to write a whole User Control to just display a single sentence.

     

  • Simon Justesen 436 posts 203 karma points
    Jul 30, 2009 @ 02:54
    Simon Justesen
    0

    I'm not used to messing around with "\r\n" in .NET, but in VB.NET, you can write chr(10), which equals a newline, or use Environment.NewLine. Another way is to replace \r\n in the string with <br> in screen content, and back when outputting mail content.

  • Robert J. Bullock 386 posts 405 karma points
    Jul 30, 2009 @ 04:41
    Robert J. Bullock
    0

    Simon, that would work, of course, but it's not a solution for what seems a bug to me.

  • Petr Snobelt 923 posts 1535 karma points
    Jul 30, 2009 @ 08:57
    Petr Snobelt
    0

    Maybe it's related to this issue

    http://umbraco.codeplex.com/WorkItem/View.aspx?WorkItemId=23002

    Don't forget to vote for it.

  • Tom Maton 387 posts 660 karma points
    Aug 05, 2009 @ 18:02
    Tom Maton
    0

    I have voted for this but unfortunately my clients site goes live on Friday and I dont think it will get fixed in a release before then. Is there a way in the XSLT to replace the \r\n with blank.

    I know this is not the greatest solution but it will be just a temporary fix

    Thanks

    Tom

  • Niels Hartvig 1951 posts 2391 karma points c-trib
    Aug 05, 2009 @ 18:09
    Niels Hartvig
    0

    If anyone can provide steps to reproduce I'd love to fix it. I've been trying and trying to re-produce, but without proper luck. So help me and I'll help you. Deal?

  • Tom Maton 387 posts 660 karma points
    Aug 05, 2009 @ 18:33
    Tom Maton
    0

    Niels you have a deal,

    I have a staging site it is happening on if you want to take a look?

    I can also provide the steps

    Thanks

    Tom

  • Niels Hartvig 1951 posts 2391 karma points c-trib
    Aug 05, 2009 @ 18:58
    Niels Hartvig
    0

    Both would be awesome. Shoot me an e-mail and I'll have a look

  • Tom Maton 387 posts 660 karma points
    Aug 05, 2009 @ 19:31
    Tom Maton
    0

    Details sent Niels

  • Petr Snobelt 923 posts 1535 karma points
    Aug 19, 2009 @ 12:22
    Petr Snobelt
    0

    @Niels: Any news or workaround on this issue?

  • Niels Hartvig 1951 posts 2391 karma points c-trib
    Aug 19, 2009 @ 13:39
    Niels Hartvig
    0

    Still investigating. Not as lucky with reproducing as I had hoped :'-(

  • dandrayne 1138 posts 2262 karma points
    Aug 19, 2009 @ 14:26
    dandrayne
    1

    Doc2Form is an easy one to reproduce this with.

    • Install umbraco & runway
    • Install doc2form
    • Insert doc2form "complete" macro into the editor (the problem only occurs for me in the editor, not with macros in templates)
    • Use multiple lines, line breaks etc in any of the macro parameters that use a textarea (such as 'response text')
    • Insert macro
    • watch the magic happen in the resulting html

    In practice, this hasn't been a massive problem as we just put the contact form macros in the template, but I can see it being a niggling problem.

  • Chris Larson 48 posts 63 karma points
    Aug 19, 2009 @ 15:05
    Chris Larson
    0

    If it helps - this can occur in any .NET User Control that passes a text value as a parameter. Typically it happens under the following conditions:

    1) User inserts macro with properties through TinyMCE.
    2) User saves document.
    3) User comes back and updates content.
    4) User saves the document again.

    After the second save (or subsequent saves), TinyMCE inserts the "\r\n" character string into the stored parameter value.

    I have reproduced this behavior using that test sequence numerous times. Hope that is of assistance!

  • Niels Hartvig 1951 posts 2391 karma points c-trib
    Aug 19, 2009 @ 15:33
    Niels Hartvig
    0

    Hi Chris!

    Thanks for the feedback. What browser/version/OS are you using. We believe that it might be related to a combination of Windows and IE and area trying to lock it down.

  • Tom Maton 387 posts 660 karma points
    Aug 19, 2009 @ 16:01
    Tom Maton
    0

    I am not sure whats going on or what but this is even more strange:

    I know Niels has tried it using the mac OS and never replicated in an environment I had set it up with the issue happening all the time.

    On the same environment I tried it on a PC (XP Professional) and it was happening all the time.

    I just went through the entire environment using a Mac and never managed to replicate it.

    So could it be a windows thing with new lines?

    in the code does it use "Environment.NewLine" or "mac has \r and unix has \n, and windows \r\n"

    Tom

  • dandrayne 1138 posts 2262 karma points
    Aug 19, 2009 @ 16:12
    dandrayne
    0

    Happens in firefox (3.0-3.5)/winXP as well

  • Chris Larson 48 posts 63 karma points
    Aug 20, 2009 @ 15:57
    Chris Larson
    1

    I've seen this in both Chrome and IE7. I haven't tested Firefox or Safari yet as I only use these to test cross-platform CSS.

    Server is Windows 2003, .NET 3.5, SQL 2005 Std.

    Niels - email me  at chris (dot) larson (at) wicatech (dot) com and we can set up a screen sharing so I can demonstrate the conditions. I can replicate this every time with a User Control I developed. The parameter field can be set as either "text" or "textMultiLine" and the same result occurs. The key here is that the macro is inserted directly into the TInyMceEditor rather than a template.

  • aaronb 97 posts 116 karma points
    Aug 27, 2009 @ 18:03
    aaronb
    0

    I'm having the same issue, here's my circumstances:

    I have a macro which works as a template to display multiple items on a page. The macro has various fields, text, media picker, and multiline text which get displayed on the page. The macro is inserted into the tinyMCE editor, so the user can choose how many products to display.

    It works flawlessly the first time, but the issue seems to be within tinyMCE's handling of the multiline text field. If I go back into that page and make any changes, re-saving it is what makes the /r/n appear in the browser (and in the macro code). With each consequtive 'save', it adds more /r/n into the text, presumably because the previous set of /r/n is making each line too long to 'fit' hence the need for a linebreak.

    I've encountered this issue before on the runway contact form subject field when more than two words are present in the subject line. I ended up hard-coding the subject as a workaround, but that won't work for my current issue.

     

     

     

     

  • Theo Xavier 8 posts 25 karma points
    Sep 23, 2009 @ 15:26
    Theo Xavier
    1

    If anyone is still being plagued by this I believe I have developed a workaround.  In my situation captionText was the victim of the dreaded \r\n's.

    ---------------------

    <xsl:value-of select="ps:replace(string($captionText),'\r\n', '  ')" disable-output-escaping="yes" />

    ...

    <msxsl:script language="C#" implements-prefix="ps">
        <![CDATA[
     
        public string replace(string s, string x, string y)
          {
              return s.Replace(x, y);
          }

          ]]>
      </msxsl:script>

    ---------------------

     

    It seems to be working for me so far.

    --Theo

  • Niels Hartvig 1951 posts 2391 karma points c-trib
    Sep 28, 2009 @ 11:01
    Niels Hartvig
    3

    Happy to report that this issue is finally fixed with 4.0.3 coming in a few days. Thank to everyone who kept saying that the issue was still present and who helped with debugging and reproducing!

  • Chris Larson 48 posts 63 karma points
    Sep 28, 2009 @ 18:22
    Chris Larson
    0

    Way to go Niels and everyone who helped with this!

  • Niels Hartvig 1951 posts 2391 karma points c-trib
    Oct 01, 2009 @ 09:24
    Niels Hartvig
    0

    Can anyone download the beta and confirm if this has fixed the issue for you too:
    http://umbraco.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=28238

  • Peter Gregory 408 posts 1614 karma points MVP 3x admin c-trib
    Oct 14, 2009 @ 05:21
    Peter Gregory
    0

    I can confirm that upgrading to 4.0.3 Beta fixes this issue.  I have just tested with a site that implements doc2form and it no longer have \r\n in the parameters.

     

  • Tom Maton 387 posts 660 karma points
    Oct 14, 2009 @ 10:15
    Tom Maton
    0

    Niels,

    Just out of interest what was causing the problem?

    Tom

  • Max 2 posts 22 karma points
    Nov 30, 2009 @ 22:30
    Max
    0

    The issue seems to have reappered in the 4.1.0 beta.

    Same as before: Adding a macro to the richtext field > publish > then open document again > open macro details > click "ok" > and they appear.
    Using: IE8, textMultiLine parameter.

  • Adam Nofsinger 2 posts 22 karma points
    Aug 03, 2010 @ 22:53
    Adam Nofsinger
    0

    I am running into this issue with 4.5.1 stable. :(

    I had Doc2Form installed, but un-installed it.  Maybe that contributed.

    I can produce it by adding a macro to the richtext field > publish > then open document again > open macro details > click "ok" > publish > and they appear.
    Using: FF3.6, textMultiLine and text parameters. They appear after the second word.

    Bump

  • Ken Mark 82 posts 94 karma points
    Aug 12, 2010 @ 09:51
    Ken Mark
    0

    Can confirm the error still exist in version 4.5.1. The fix above doesn't work either, because the \r\n is not saved to the umbraco.config file. (It you click the HTML-button in tinyMCE you'll see it though)

     

  • Adam Nofsinger 3 posts 23 karma points
    Aug 12, 2010 @ 16:26
    Adam Nofsinger
    0

    Well, the \r\n DOES show up in the umbraco.config file, but depending on what you are looking at that in (probably visual studio or something, right?) then it will show up as an actual newline. E.g.:

    <someProp>It is after me
    in this setting</someProp>

    I was able to work around it (although it really should be fixed!) by doing a Replace("\r\n", " ") on the resulting string in the user control code-behind, although I realize that won't work for every circumstance.

    Go here and vote/comment!: http://umbraco.codeplex.com/workitem/23002

  • Ken Mark 82 posts 94 karma points
    Aug 13, 2010 @ 09:22
    Ken Mark
    0

    Acutally I'm looking at umbraco.config in Notepad and I can't se any \r\n, but I see it in the tinyMCE source.

  • Adam Nofsinger 3 posts 23 karma points
    Aug 13, 2010 @ 16:49
    Adam Nofsinger
    0

    Kenneth, not sure that it even really matters, but here is what I mean:

    <?UMBRACO_MACRO sendemailusingssl="0" successmessage="Thank
    you for your message. We should get back to you shortly."
    emailfootertext="http://bobsforestproducts.com"
    macroAlias="ContactForm" emailtitle="Bobs Forest Products
    Contact Form Submission" sendemailto="[email protected]"
    />

    This is what the macro looks like in my Umbraco.config, newlines and all! (Names have been changed to protect the innocent :).  So, my usercontrol is trying to send an email using the EmailTitle property on the usercontrol, but it is throwing an exception because you cannot have a newline in an email subject. If I step into the code, I see that my EmailTitle Propertly looks like this in the debugger:

    "Bobs Forest Products\r\nContact Form Submission"

    See! The newline in the string directly corresponds with where there is an actual newline in the Umbraco.config file. Not that it really matters, the umbraco.config file is automatically generated from what is in the database. If I try fixing the Umbraco.config to look like this:

    <?UMBRACO_MACRO sendemailusingssl="0" successmessage="Thank you for your message. We should get back to you shortly."
    emailfootertext="http://bobsforestproducts.com" macroAlias="ContactForm" 
    emailtitle="Bobs Forest Products Contact Form Submission" sendemailto="[email protected]" />

    Umbraco will faithfully blast away those changes and overwrite them with what is in the database.

  • Josh Reid 182 posts 258 karma points
    Feb 18, 2011 @ 22:32
    Josh Reid
    1

    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.

    Cheers
    Josh

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Feb 18, 2011 @ 22:51
    Jan Skovgaard
    0

    Hi Josh

    I think you should also make people aware that your solution 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 know that this may be a "non-issue" on in many solutions but people should be aware what the downside of this could be.

    I must admit that I'm more likely to use the Replace option instead :-)

    Cheers

    /Jan

  • Josh Reid 182 posts 258 karma points
    Feb 18, 2011 @ 22:57
    Josh Reid
    0

    Sure thing you are absolutely correct Jan, thanks.

     

  • Josh Reid 182 posts 258 karma points
    Feb 18, 2011 @ 22:58
    Josh Reid
    1

    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

  • Søren Spelling Lund 1797 posts 2786 karma points
    Oct 27, 2011 @ 14:12
    Søren Spelling Lund
    0

    I believe I've found the steps to repro this issue. It was driving me nuts for a while but I figured it was probably my install that was borked.

    I updated the Codeplex thread with the repro steps for Umbraco 4.7.1 with the Simple Website installed http://umbraco.codeplex.com/workitem/23002?ProjectName=umbraco

     

Please Sign in or register to post replies

Write your reply to:

Draft