Let's escape strings for javascript

Fix #1048
Merge pull request #1049 from mlocati/fix-1048

Let's escape strings for javascript