If you have a bunch of funky data to store in a JavaScript string, for example some HTML, you have to be careful to “escape” all the special characters so it doesn’t break your script.
Or you can just use my web data encoder and choose “JavaScript-safe” variable:
You can also use other encodings, such as encodeURIComponent to make a complex URL safe to pass as a component of another URL.
