1curl_easy_escape(3)             libcurl Manual             curl_easy_escape(3)
2
3
4

NAME

6       curl_easy_escape - URL encodes the given string
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       char *curl_easy_escape( CURL *curl, const char *string , int length );
12

DESCRIPTION

14       This  function  converts the given input string to a URL encoded string
15       and returns that as a new allocated string. All input  characters  that
16       are not a-z, A-Z, 0-9, '-', '.', '_' or '~' are converted to their "URL
17       escaped" version (%NN where NN is a two-digit hexadecimal number).
18
19       If length is set to 0 (zero), curl_easy_escape(3) uses strlen() on  the
20       input string to find out the size.
21
22       You must curl_free(3) the returned string when you're done with it.
23

ENCODING

25       libcurl  is  typically  not aware of, nor does it care about, character
26       encodings. curl_easy_escape(3) encodes the data byte-by-byte  into  the
27       URL encoded version without knowledge or care for what particular char‐
28       acter encoding the application or the receiving server may assume  that
29       the data uses.
30
31       The  caller  of curl_easy_escape(3) must make sure that the data passed
32       in to the function is encoded correctly.
33

AVAILABILITY

35       Added in 7.15.4 and replaces the old curl_escape(3) function.
36

RETURN VALUE

38       A pointer to a zero terminated string or NULL if it failed.
39

EXAMPLE

41       CURL *curl = curl_easy_init();
42       if(curl) {
43         char *output = curl_easy_escape(curl, "data to convert", 15);
44         if(output) {
45           printf("Encoded: %s\n", output);
46           curl_free(output);
47         }
48       }
49

SEE ALSO

51       curl_easy_unescape(3), curl_free(3), RFC3986
52
53
54
55libcurl 7.61.1                  August 12, 2017            curl_easy_escape(3)
Impressum