Say you want to build a URL out of your results, but they might contain characters that you need to escape. In this case you can use the urlEncode() method provided by the GeneralUtils object like this:

#set($param = $generalUtil.urlEncode("b:a/r"))
#set($url = "./viewpage.action?pageId=12345678&foo=${param}&ping=pong")
CODE

The result will be a correctly encoded URL:

./viewpage.action?pageId=12345678&foo=b%3Aa%2Fr&ping=pong
CODE