1curl_unescape(3) libcurl curl_unescape(3)
2
3
4
6 curl_unescape - URL decodes the given string
7
9 #include <curl/curl.h>
10
11 char *curl_unescape(const char *input, int length);
12
14 Obsolete function. Use curl_easy_unescape(3) instead!
15
16 This function will convert the URL encoded string input to a "plain
17 string" and return that as a new allocated string. All input characters
18 that are URL encoded (%XX where XX is a two-digit hexadecimal number)
19 will be converted to their plain text versions.
20
21 If the length argument is set to 0, curl_unescape(3) will use strlen()
22 on input to find out the size.
23
24 You must curl_free(3) the returned string when you are done with it.
25
27 CURL *curl = curl_easy_init();
28 if(curl) {
29 int decodelen;
30 char *decoded = curl_unescape("%63%75%72%6c", 12, &decodelen);
31 if(decoded) {
32 /* do not assume printf() works on the decoded data! */
33 printf("Decoded: ");
34 /* ... */
35 curl_free(decoded);
36 }
37 }
38
40 Since 7.15.4, curl_easy_unescape(3) should be used. This function will
41 be removed in a future release.
42
44 A pointer to a null-terminated string or NULL if it failed.
45
47 curl_easy_escape(3),curl_easy_unescape(3),curl_free(3),RFC2396
48
49
50
51libcurl 8.2.1 April 26, 2023 curl_unescape(3)