the following will return text with non alphanumerics replace with their hex equivalents.

usage: $urlencode(string)
Code:
alias urlencode {
  var %cRet = $1-
  while ($regex(%cRet, /([^\w-.\x03])/)) {
    !haltdef $regsub(%cRet, /([^\w-.\x03])/,  $+ $base($asc($regml(1)), 10, 16, 2), %cRet)
  }
  return $replace(%cRet, , %)
}