Equivalent of JavaScript's encodeURIComponent() function for mailto: links?

Equivalent of JavaScript's encodeURIComponent() function for mailto: links?

Hi folks,

I need to take a few variables (to, cc, bcc, subject) and a small amount of text (from a Creator rich text field, with some very simple formatting, line breaks, etc.) as a message body, then parse it into a mailto: link to pass to the user's browser so that their default email client opens a compose window with the relevant details filled - ready to edit and send.

If I were working in JavaScript, I'd pull the rich text out as HTML, add the variables in the relevant order, and throw the whole thing at encodeURIComponent() - which can take input including spaces, line breaks, etc. - in order to output a valid URL.

Zoho's encodeUrl() doesn't seem to be up to the task - it looks like it only cleans an already otherwise-well-formed URL.

Has anyone else had this situation, or can anyone suggest a solution?

Thanks in advance,

James