curl_unescape.3 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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_unescape 3 "22 March 2001" "libcurl" "libcurl"
  25. .SH NAME
  26. curl_unescape - URL decodes the given string
  27. .SH SYNOPSIS
  28. .nf
  29. #include <curl/curl.h>
  30. char *curl_unescape(const char *input, int length);
  31. .fi
  32. .SH DESCRIPTION
  33. Obsolete function. Use \fIcurl_easy_unescape(3)\fP instead!
  34. This function converts the URL encoded string \fBinput\fP to a "plain string"
  35. and return that as a new allocated string. All input characters that are URL
  36. encoded (%XX where XX is a two-digit hexadecimal number) are converted to
  37. their plain text versions.
  38. If the \fBlength\fP argument is set to 0, \fIcurl_unescape(3)\fP calls
  39. strlen() on \fBinput\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. CURL *curl = curl_easy_init();
  44. if(curl) {
  45. int decodelen;
  46. char *decoded = curl_unescape("%63%75%72%6c", 12, &decodelen);
  47. if(decoded) {
  48. /* do not assume printf() works on the decoded data! */
  49. printf("Decoded: ");
  50. /* ... */
  51. curl_free(decoded);
  52. }
  53. }
  54. .fi
  55. .SH AVAILABILITY
  56. Since 7.15.4, \fIcurl_easy_unescape(3)\fP should be used. This function might
  57. be removed in a future release.
  58. .SH RETURN VALUE
  59. A pointer to a null-terminated string or NULL if it failed.
  60. .SH "SEE ALSO"
  61. .BR curl_easy_escape "(3)," curl_easy_unescape "(3)," curl_free "(3)," RFC 2396