Encode URL Question

Encode URL Question

I am populating a string field on a form via an email with some text from another system.  I am then using a URL to open another form and default this data on that form.  This works great EXCEPT when there are line feeds or other non-allowed characters in the initial string feed (e.g &).  I have tried to use the encodeUrl function, but instead of converting the spaces in the string field to %20 (as I would expect) they are being converted to "+" and passed to the new form this way.   Am I doing this incorrectly? 

I attached sample code to this post.