curl_escape DEPRECATED


#include <curl/curl.h>

char *curl_escape( char * url , int length );


url Pointer to the string to be encoded.
length Length of the string to be encoded.

Return Values

A pointer to a zero-terminated string or NULL if it failed.


Obsolete function. Use curl_easy_escape instead.

This function will convert the given input string to an URL encoded string and return that as a new allocated string. All input characters that are not a-z, A-Z or 0-9 will be converted to their "URL escaped" version (%nn, where nn is a two-digit hexadecimal number).

If the length argument is set to 0, curl_escape will use strlen on the input url string to discover the size.

When done, use curl_free on the returned string.

Do Not Call From

Deprecated Do not call this function in new code.

See Also

HTTP Client Library (libcurl)
libcurl API Functions
libcurl Error Codes
RFC 2396 (

Revision History

2014/06/24 Reworked external link.
2013/09/18 Conversion
2013/05/08 Automated cleanup pass.
2012/05/04 Initial version.