gnurl_easy_unescape(3)
π gnurl_easy_unescape β the URL decoder bestie we all need β¨
Okay so real talk, this is a page from the libgnurl Manual, and it's all about one little function that un-escapes URL-encoded strings for you. Think of it as the glow-up machine for ugly %XX-laden text. π«Ά
πΈ NAME πΈ
curl_easy_unescape β literally decodes a URL-encoded string back into a plain one. No cap. π
β¨ SYNOPSIS β¨
#include <gnurl/curl.h>
char *curl_easy_unescape( CURL *curl, const char *url , int inlength,
int *outlength );
Slay, that's the whole signature. Yes the spacing is a lil quirky, but it's iconic and we keep it exactly like that. π
π¦ DESCRIPTION π¦
So what does this actually do? Bestie, it takes the URL-encoded input string you hand it and converts it into a "plain string", then returns that in a chunk of allocated memory. Every single input character that's URL encoded β meaning %XX where XX is a two-digit hexadecimal number β gets converted to its binary version. That's the whole vibe. β¨
If the length argument is set to 0 (zero), then curl_easy_unescape(3) is gonna call strlen() on the input url string to figure out the size for you. So you don't have to count, it's got you. π
If outlength is non-NULL, the function writes the length of the returned string into the integer it points to. Why do we care? Because this is what allows an escaped string containing %00 to still get used properly after unescaping β otherwise that null byte would be a whole mess. And listen: since this is a pointer to an int type, it can only return a value up to INT_MAX, so no longer string can be unescaped if the string length is returned in this parameter. That's a hard limit, not a vibe check. π
β οΈ You must curl_free(3) the returned string when you're done with it. Not optional, not a suggestion. Free your memory, babes. π§
π AVAILABILITY π
Added in 7.15.4 and it replaces the old curl_unescape(3) function. So it's the newer, cooler, main-character version. π₯
π RETURN VALUE π
A pointer to a null-terminated string, or NULL if it failed. That's it. Either it ate and left no crumbs, or it flopped with NULL. π
π SEE ALSO π
Go read those if you wanna be thorough, iykyk. π
Okay that's the whole page! This one's from libcurl 7.15.4, dated 7 April 2006 β so like, vintage but still iconic. Bye bestie, go unescape something! πβ¨ππ¦πΈ
π¦ 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