Texbox multiple linebreaks change from \n to \r\n after republish
Hi,
the linebreaks change from \n to \r\n after republish entire site.
Steps to reproduce in version 7.1.8 and 7.2.6:
create a new document type named 'page' with matching template
add a textbox multiple property to the 'page' document type named 'list'
create a new page in the content tree fill in the 'list' property
with 'one','two' and 'three' with a linebreak in between
hit save and publish open the 'page' template change to
Page template:
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
Layout = null;
var list = Umbraco.Field("list").ToHtmlString();
}
@list
After a save a publish the variable will contain= "one\ntwo\nthree"
After a republish entire site the variable will contain= "one\r\ntwo\r\nthree"
The convertLineBreaks option has no issue with this situation. But dependent code we use does a split using '\n' character to compare the values. After a republish this compare does not work anymore since the values are now "one\r", "two\r" and "three".
The cache (umbraco.config) saves the value as
<![CDATA[oneCRLF
twoCRLF
three]]>
Anyone any clue?
Meanwhile I'm looking at the Umbraco sources but I'm not familiar with the internals of content retrieval.
I would be very curious to know how Umbraco actually does that "republish entire site", since any XML compliant tool should have normalized linebreaks to a single LF character before doing any further processing.
Lurking here to be notified of any info you find...
If by "republish all" you mean the "content" node right-click menu, then what happens is, the entire in-memory xml cache (the one that is saved in umbraco.config) is rebuilt from scratch by re-loading each node's xml fragment from the cmsContentXml table.
Whereas during the initial "save & publish", that xml fragment is generated locally and then it is inserted into the main xml cache document.
I'd need to look into the actual code, but what most probably happens is that the back-office editor returns "foo\nbar" as a value (would make sense for JavaScript) which is used as-is when creating the local xml cache, but somehow when that xml fragment is saved to cmsContentXml or when we read it back, the value is normalized to "foo\r\nbar".
Texbox multiple linebreaks change from \n to \r\n after republish
Hi, the linebreaks change from \n to \r\n after republish entire site.
Steps to reproduce in version 7.1.8 and 7.2.6:
Page template:
After a save a publish the variable will contain= "one\ntwo\nthree" After a republish entire site the variable will contain= "one\r\ntwo\r\nthree"
The convertLineBreaks option has no issue with this situation. But dependent code we use does a split using '\n' character to compare the values. After a republish this compare does not work anymore since the values are now "one\r", "two\r" and "three".
The cache (umbraco.config) saves the value as
Anyone any clue? Meanwhile I'm looking at the Umbraco sources but I'm not familiar with the internals of content retrieval.
Regards Bart
I would be very curious to know how Umbraco actually does that "republish entire site", since any XML compliant tool should have normalized linebreaks to a single
LF
character before doing any further processing.Lurking here to be notified of any info you find...
Chriztian, you could have clicked the "follow" button ;-)
(meanwhile I 'll be notified too :-D)
Haha - Yes, I know :-)
But I had to state my curiousness about the XML normalization too... :-)
If by "republish all" you mean the "content" node right-click menu, then what happens is, the entire in-memory xml cache (the one that is saved in umbraco.config) is rebuilt from scratch by re-loading each node's xml fragment from the cmsContentXml table.
Whereas during the initial "save & publish", that xml fragment is generated locally and then it is inserted into the main xml cache document.
I'd need to look into the actual code, but what most probably happens is that the back-office editor returns "foo\nbar" as a value (would make sense for JavaScript) which is used as-is when creating the local xml cache, but somehow when that xml fragment is saved to cmsContentXml or when we read it back, the value is normalized to "foo\r\nbar".
Can you file an issue?
Hi Stephan, I was indeed writing about the right click on 'content' and click on 'Republish entire site'.
I will create an issue for this. Tnx for the feedback
Bart
I'd look for anywhere the XML is handled as "plain text" instead of XML - would be a prime suspect :)
Issue U4-6785 is created for this issue http://issues.umbraco.org/issue/U4-6785
Confirmed (see issue tracker) and fixed.
Thank you very much !!
is working on a reply...