quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

curl_escape.md (1276B)


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