I was working on a bit of script today, and happened upon an interesting happenstance. I was trying to change the text of an element dynamically, and this text needed to include a non-breaking space. My original code seemed to render the entity as text, so this:
elem.setText( ' ' );
literally printed the text " " instead of the proper entity.
My solution ended up being to change the entity entirely:
elem.setText( '\\u00a0' );