This function encodes the input object. If the object is a string, it is escaped as HTML. If the object is a key, it is encoded as Base64. Anything else is converted to a string using toString() method.
and sample source
Continue to url.