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?
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!
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.
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.
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
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?
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!
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.
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.
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.
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!
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.
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.
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.
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)
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.
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.
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 :-)
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.
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
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!
FYI, since I'm using a User Control, there's no way to specify the datatype for any given property.
Oh wait, yeah, I can. Duh. Sorry.
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.
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.
Simon, that would work, of course, but it's not a solution for what seems a bug to me.
Maybe it's related to this issue
http://umbraco.codeplex.com/WorkItem/View.aspx?WorkItemId=23002
Don't forget to vote for it.
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
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?
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
Both would be awesome. Shoot me an e-mail and I'll have a look
Details sent Niels
@Niels: Any news or workaround on this issue?
Still investigating. Not as lucky with reproducing as I had hoped :'-(
Doc2Form is an easy one to reproduce this with.
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.
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!
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.
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
Happens in firefox (3.0-3.5)/winXP as well
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.
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.
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
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!
Way to go Niels and everyone who helped with this!
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
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.
Niels,
Just out of interest what was causing the problem?
Tom
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.
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
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)
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
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.
Kenneth, not sure that it even really matters, but here is what I mean:
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:
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 will faithfully blast away those changes and overwrite them with what is in the database.
Hey all...
I have found it successful to set the use of Tidy in umbracoSettings.config to false.
This removes the offending /r/n characters from macro parameters.
Cheers
Josh
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
Sure thing you are absolutely correct Jan, thanks.
Hey all...
I have found it successful to set the use of Tidy in umbracoSettings.config to false.
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
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
is working on a reply...