1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: curl_unescape 5Section: 3 6Source: libcurl 7See-also: 8 - RFC 2396 9 - curl_easy_escape (3) 10 - curl_easy_unescape (3) 11 - curl_free (3) 12Protocol: 13 - All 14Added-in: 7.1 15--- 16 17# NAME 18 19curl_unescape - URL decode a string 20 21# SYNOPSIS 22 23~~~c 24#include <curl/curl.h> 25 26char *curl_unescape(const char *input, int length); 27~~~ 28 29# DESCRIPTION 30 31Deprecated. Use curl_easy_unescape(3) instead. 32 33This function converts the URL encoded string **input** to a "plain string" 34and return that as a new allocated string. All input characters that are URL 35encoded (%XX where XX is a two-digit hexadecimal number) are converted to 36their plain text versions. 37 38If the **length** argument is set to 0, curl_unescape(3) calls 39strlen() on **input** to find out the size. 40 41You must curl_free(3) the returned string when you are done with it. 42 43# %PROTOCOLS% 44 45# EXAMPLE 46 47~~~c 48int main(void) 49{ 50 CURL *curl = curl_easy_init(); 51 if(curl) { 52 char *decoded = curl_unescape("%63%75%72%6c", 12); 53 if(decoded) { 54 /* do not assume printf() works on the decoded data */ 55 printf("Decoded: "); 56 /* ... */ 57 curl_free(decoded); 58 } 59 } 60} 61~~~ 62 63# DEPRECATED 64 65Since 7.15.4, curl_easy_unescape(3) should be used. This function might 66be removed in a future release. 67 68# %AVAILABILITY% 69 70# RETURN VALUE 71 72A pointer to a null-terminated string or NULL if it failed. 73