curl_escape.3 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. .\" generated by cd2nroff 0.1 from curl_escape.md
  2. .TH curl_escape 3 "2025-01-17" libcurl
  3. .SH NAME
  4. curl_escape \- URL encode a string
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. char *curl_escape(const char *string, int length);
  9. .fi
  10. .SH DESCRIPTION
  11. Obsolete function. Use \fIcurl_easy_escape(3)\fP instead!
  12. This function converts the given input \fBstring\fP to a URL encoded string
  13. and return that as a new allocated string. All input characters that are not
  14. a\-z, A\-Z or 0\-9 are converted to their "URL escaped" version (\fB%NN\fP where
  15. \fBNN\fP is a two\-digit hexadecimal number).
  16. If the \fBlength\fP argument is set to 0, \fIcurl_escape(3)\fP uses strlen()
  17. on \fBstring\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. char *output = curl_escape("data to convert", 15);
  26. if(output) {
  27. printf("Encoded: %s\\n", output);
  28. curl_free(output);
  29. }
  30. }
  31. .fi
  32. .SH HISTORY
  33. Since 7.15.4, \fIcurl_easy_escape(3)\fP should be used. This function might be
  34. removed in a future release.
  35. .SH AVAILABILITY
  36. Added in curl 7.1
  37. .SH RETURN VALUE
  38. A pointer to a null\-terminated string or NULL if it failed.
  39. .SH SEE ALSO
  40. .BR curl_free (3),
  41. .BR curl_unescape (3)