AnsweredAssumed Answered

Oddity with Content.getBody()

Question asked by vickers.stephen on Feb 28, 2018

When I use the getBody() method on a Blackboard generated content item which has more than one paragraph, the new line between the paragraphs is returned as a space (ASCII 32) followed by a line feed (ASCII 10).  The same code run against an item created by one of my own building blocks has a carriage return (ASCII 13) followed by a line feed (ASCII 10) which is exactly what I would expect, especially as no space is displayed in the HTML view of the content editor.  In all the cases I have tried the type of the FormattedText object representing the body has been HTML.

Is anyone able to explain why there is this difference in behaviour and why carriage returns should be replaced by spaces in the first place?

(I have attached a script which demonstrates this behaviour - just call it with the ID of a content item in the query string; e.g. .../getbody.jsp?content_id=_x_1.)

Attachments

Outcomes