curl_escape.3 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
  9. .\" *
  10. .\" * This software is licensed as described in the file COPYING, which
  11. .\" * you should have received as part of this distribution. The terms
  12. .\" * are also available at https://curl.se/docs/copyright.html.
  13. .\" *
  14. .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. .\" * copies of the Software, and permit persons to whom the Software is
  16. .\" * furnished to do so, under the terms of the COPYING file.
  17. .\" *
  18. .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. .\" * KIND, either express or implied.
  20. .\" *
  21. .\" * SPDX-License-Identifier: curl
  22. .\" *
  23. .\" **************************************************************************
  24. .TH curl_escape 3 "6 March 2002" "libcurl" "libcurl"
  25. .SH NAME
  26. curl_escape - URL encodes the given string
  27. .SH SYNOPSIS
  28. .nf
  29. #include <curl/curl.h>
  30. char *curl_escape(const char *string, int length);
  31. .fi
  32. .SH DESCRIPTION
  33. Obsolete function. Use \fIcurl_easy_escape(3)\fP instead!
  34. This function will convert the given input \fBstring\fP to a URL encoded string
  35. and return that as a new allocated string. All input characters that are not
  36. a-z, A-Z or 0-9 will be converted to their "URL escaped" version (\fB%NN\fP
  37. where \fBNN\fP is a two-digit hexadecimal number).
  38. If the \fBlength\fP argument is set to 0, \fIcurl_escape(3)\fP will use
  39. strlen() on \fBstring\fP to find out the size.
  40. You must \fIcurl_free(3)\fP the returned string when you are done with it.
  41. .SH EXAMPLE
  42. .nf
  43. char *output = curl_escape("data to convert", 15);
  44. if(output) {
  45. printf("Encoded: %s\\n", output);
  46. curl_free(output);
  47. }
  48. .fi
  49. .SH AVAILABILITY
  50. Since 7.15.4, \fIcurl_easy_escape(3)\fP should be used. This function will
  51. be removed in a future release.
  52. .SH RETURN VALUE
  53. A pointer to a null-terminated string or NULL if it failed.
  54. .SH "SEE ALSO"
  55. .BR curl_unescape "(3), " curl_free "(3), " RFC 2396