gnurl_easy_escape(3)
π gnurl_easy_escape(3) β URL encodes the given string, bestie π
okay so this page is from the libgnurl Manual, and itβs all about curl_easy_escape β yes, the page itself is filed as gnurl_easy_escape(3), iykyk π«Ά. Itβs giving URL-encoding main character energy β¨.
πΈ NAME πΈ
curl_easy_escapeβ URL encodes the given string
β¨ SYNOPSIS β¨
#include <gnurl/curl.h>
char *curl_easy_escape( CURL *curl, const char *string , int length );
π DESCRIPTION π
Hereβs the tea, bestie: this function converts the given input string to a URL encoded string and returns that as a new allocated string. All input characters that are not a-z, A-Z, 0-9, '-', '.', '_' or '~' are converted to their "URL escaped" version (%NN where NN is a two-digit hexadecimal number). π
If length is set to 0 (zero), curl_easy_escape(3) uses strlen() on the input string to find out the size. Cute, right? π
You must curl_free(3) the returned string when youβre done with it. Like, actually must β do not skip this one π«Ά.
π₯ ENCODING π₯
libcurl is typically not aware of, nor does it care about, character encodings. curl_easy_escape(3) encodes the data byte-by-byte into the URL encoded version without knowledge or care for what particular character encoding the application or the receiving server may assume that the data uses.
The caller of curl_easy_escape(3) must make sure that the data passed in to the function is encoded correctly. Thatβs on you, bestie β the function is not doing vibe checks on encodings π.
β AVAILABILITY β
Added in 7.15.4 and replaces the old curl_escape(3) function. Iconic. π
π RETURN VALUE π
A pointer to a null-terminated string or NULL if it failed. Thatβs it, thatβs the return value π.
π EXAMPLE π
CURL *curl = curl_easy_init();
if(curl) {
char *output = curl_easy_escape(curl, "data to convert", 15);
if(output) {
printf("Encoded: %s\n", output);
curl_free(output);
}
}
π¦ SEE ALSO π¦
kisses and URL-encoded dreams π this page is from libcurl 7.15.4, dated 7 April 2006, and itβs filed under gnurl_easy_escape(3) π«Ά
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms