Fix bug #1645

A JavaScript string is being generated quoted by the ' character. If
it finds that character in a string inside the evaled JavaScript it
would terminate the string prematurely, causing syntax errors.