1curl_escape(3) libcurl Manual curl_escape(3)
2
3
4
6 curl_escape - URL encodes the given string
7
9 #include <curl/curl.h>
10
11 char *curl_escape(const char *url, int length);
12
14 Obsolete function. Use curl_easy_escape(3) instead!
15
16 This function will convert the given input string to an URL encoded
17 string and return that as a new allocated string. All input characters
18 that are not a-z, A-Z or 0-9 will be converted to their "URL escaped"
19 version (%NN where NN is a two-digit hexadecimal number).
20
21 If the lengthf argument is set to 0, curl_escape() will use strlen() on
22 the input url string to find out the size.
23
24 You must curl_free(3) the returned string when you are done with it.
25
27 char *output = curl_escape("data to convert", 15);
28 if(output) {
29 printf("Encoded: %s\n", output);
30 curl_free(output);
31 }
32
34 Since 7.15.4, curl_easy_escape(3) should be used. This function will be
35 removed in a future release.
36
38 A pointer to a null-terminated string or NULL if it failed.
39
41 curl_unescape(3), curl_free(3), RFC2396
42
43
44
45libcurl 7.82.0 November 26, 2021 curl_escape(3)