Wednesday, October 28, 2009

@URLEncode and X-pages

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

attachmentnames = java.net.URLEncoder.encode(@AttachmentNames(),"UTF-8")

3 comments:

Henry Newberry said...

Perhaps I am missing something here, but you could use the javascript escape directive to acomplish much the same thing.

escape(@AttachmentNames);

Newbs

Web development said...

Nice post for any kind for information related with web development and web site design click on web development.
Hear you get all the information about web site design.

Anonymous said...

Unfortunatly, in 8.5.1 the escape() command is not (yet) implemented. I found that these do not work in serverside JavaScript in Notes 8.5.1:
@UrlEncode
encodeURI
encodeURIComponent

Axel Neuhaus

Post a Comment