Helper function to encode a string for inclusion in a URI. All
characters are replaced by their hex-escaped (%22) equivalents,
except for characters explicitly unreserved by RFC3986 -- that is,
ASCII alphanumeric characters, hyphen, dot, underscore, and tilde.
The returned string must be freed by the caller.
@param str an unencoded string
@return a newly allocated URI-encoded string or NULL on failure
Helper function to encode a string for inclusion in a URI. All characters are replaced by their hex-escaped (%22) equivalents, except for characters explicitly unreserved by RFC3986 -- that is, ASCII alphanumeric characters, hyphen, dot, underscore, and tilde.
The returned string must be freed by the caller.
@param str an unencoded string @return a newly allocated URI-encoded string or NULL on failure