Fix bug with js print() breaking on certain characters

The message text needs to be escaped before beign evaluated.
Add carriage return to escaped string in print()
Merge pull request #2853 from huffman/fix-print

Fix bug with js print() breaking on certain characters