scan_urlencoded(3)
scan_urlencoded(3) π
okay bestie, welcome to the scan_urlencoded page, straight out of the Library Functions Manual β¨
β¨ NAME β¨
scan_urlencoded β it decodes urlencoded data, that's the whole gig π
πΈ SYNTAX πΈ
#include <libowfat/textcode.h>
size_t scan_urlencoded(const char *src,char *dest,size_t* destlen);
π¦ DESCRIPTION π¦
so scan_urlencoded takes urlencoded data from src and decodes it into dest, no cap π
Decoding stops the moment it runs into any invalid input characters β and yes that includes ' ', '?' and '&' π it's giving "we're done here."
Then it writes the number of decoded bytes sitting in dest into *destlen, and returns the number of bytes it decoded from src. two numbers, one call, iconic behavior π
β οΈ now listen, the plus character is handled differently depending on whether we're encoding the query part or the path (application/x-www-form-urlencoded). In"http://example.com/a+b?c+d", only the second plus can be decoded as a space character. If you want+decoded to space, usescan_urlencoded2. fr fr, don't skip this part π
quick facts, bestie:
destcan beNULLβdestlencan beNULLβdestcan besrc(yes, in-place, main character energy) β
π RETURN VALUE π
scan_urlencoded returns the number of bytes successfully scanned and processed from src. that's it, that's the tea π
π EXAMPLES π
scan_urlencoded("foo%3ebar",buf,&i) -> return 9, i=7, buf="foo.bar"
scan_urlencoded("foo+bar",buf,&i) -> return 7, i=7, buf="foo+bar"
scan_urlencoded2("foo+bar",buf,&i) -> return 7, i=7, buf="foo bar"
see how the + just sits there in the first +bar one? π that's the whole point, and scan_urlencoded2 is the one that turns it into a space π«Ά
π SEE ALSO π
and that's the page!! π this was scan_urlencoded(3) from the Library Functions Manual β go decode something slay, mwah πβ¨
π¦ where this page comes from
- alpine 3.24: libowfat-doc 0.34-r0 Β· GPL-2.0-only
- debian bookworm: libowfat-dev 0.32-4 Β· GPL-2.0-only
- debian trixie: libowfat-dev 0.32-5 Β· GPL-2.0-only
- nixos 26.05: libowfat 0.34
- nixpkgs unstable: libowfat 0.34
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- ubuntu noble: libowfat-dev 0.32-4.1build1 Β· GPL-2.0-only
- ubuntu questing: libowfat-dev 0.32-5
- ubuntu resolute: libowfat-dev 0.34-2 Β· GPL-2.0-only
- ubuntu stonking: libowfat-dev 0.34-2 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms