Description:-

This is used to encode the input string for safe output in URLs to prevent cross-site scripting attacks.

encodeForURL( string [, canonicalize] );

Attributes:-

string:- This is a required argument, the string which needs to be encoded.

canonicalize:- This is a non-required attribute, this is a boolean argument, and the default value is false.

Example:-

newText = "test.new15$4@gmail.com";
writeOutput( "before encoded:- #newText#" );
writeOutput( "after encoded:- #encodeForURL( newText )#" );

Result:-

before encode:- test.new15$4@gmail.com
after encode:- test.new15%244%40gmail.com

Note:- there is another function that also presents for the same work which is urlEncodedFormat( ), but the use of this function is discouraged. It is recommended that you use encodeForURL( ) it for all new applications.