curl_unescape.3 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. .\" generated by cd2nroff 0.1 from curl_unescape.md
  2. .TH curl_unescape 3 "2025-01-17" libcurl
  3. .SH NAME
  4. curl_unescape \- URL decode a string
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. char *curl_unescape(const char *input, int length);
  9. .fi
  10. .SH DESCRIPTION
  11. Deprecated. Use \fIcurl_easy_unescape(3)\fP instead.
  12. This function converts the URL encoded string \fBinput\fP to a "plain string"
  13. and return that as a new allocated string. All input characters that are URL
  14. encoded (%XX where XX is a two\-digit hexadecimal number) are converted to
  15. their plain text versions.
  16. If the \fBlength\fP argument is set to 0, \fIcurl_unescape(3)\fP calls
  17. strlen() on \fBinput\fP to find out the size.
  18. You must \fIcurl_free(3)\fP the returned string when you are done with it.
  19. .SH PROTOCOLS
  20. This functionality affects all supported protocols
  21. .SH EXAMPLE
  22. .nf
  23. int main(void)
  24. {
  25. CURL *curl = curl_easy_init();
  26. if(curl) {
  27. char *decoded = curl_unescape("%63%75%72%6c", 12);
  28. if(decoded) {
  29. /* do not assume printf() works on the decoded data */
  30. printf("Decoded: ");
  31. /* ... */
  32. curl_free(decoded);
  33. }
  34. }
  35. }
  36. .fi
  37. .SH DEPRECATED
  38. Since 7.15.4, \fIcurl_easy_unescape(3)\fP should be used. This function might
  39. be removed in a future release.
  40. .SH AVAILABILITY
  41. Added in curl 7.1
  42. .SH RETURN VALUE
  43. A pointer to a null\-terminated string or NULL if it failed.
  44. .SH SEE ALSO
  45. .BR RFC 2396,
  46. .BR curl_easy_escape (3),
  47. .BR curl_easy_unescape (3),
  48. .BR curl_free (3)