Are you using a TextArea for showing the Attribute?
A TextBox won't show these newlines.
Can you explain why it is not working for you? Because the above method should work.
Regards,
Ronald
[EDIT]
Or is the problem that you would like to put newlines into the unlimited string?
"Works on my machine" for both limited and unlimited string...
Try showing $history in a message. And show it in the console. See if newlines do or don't show up there.
Also: in what version are you experiencing this?