I have a script which generates some HTML. I like having the HTML print to a <textarea> since it's easy to copy/paste from.
The problem is the script outputs raw HTML, but the obviously, something like:
<script LANGUAGE=javascript type="text/javascript"><!--
testdata = 'robert';
//--></SCRIPT>
can't just be inserted between <textarea> as it's not urlencoded... but when I do URL encode, it removes spacing and all that fun stuff.
So what's the most efficient (quickest) way to have it encode what needs to be encoded, so that it outputs to the text box and looks good?