The function ecm:urlEncodeUsingCharset encodes the specified object as a URL using the specified character set. The value returned is a string data type.

Example

A registration link is included in a message that takes the information stored in the recipient attribute user.LastName and passes it as a variable to the registration page. The message itself is encoded using the ISO-8859-15 character set.

URL encoding ensures that last names with spaces (de la Hoya, van der Waal) or special characters (Nuñez, Köhl) do not break the link.

The HTML for inserting the link in a message is constructed as follows:

<a href="http://host/cmd.jsp?user=<%${ecm:urlEncodeUsingCharset(user['LastName']), 'ISO-8859-15'}%>">Register</a>
CODE

Structure​

ecm:urlEncodeUsingCharset(object, string)

Parameters​

Parameter

Description

object

Specifies the target object to encode.

string

Specifies the character set used to encode the target object.