Improve escape_javascript handling