I had a circumstance where i needed to encode a variable with spaces into a web link via ssjs. So i looked for @URLEncode(), it not there.... So I emailed Paul Hannan and asked if there was a way to do this, and as usual he came back with a quick response with an answer.
Here is the code i used in SSJS
3: attachmentnames = java.net.URLEncoder.encode(@AttachmentNames(),"UTF-8")