stringprep(3)

πŸ’– stringprep(3) β€” bestie edition πŸ’–

okay so this is a page from the libidn manual (that's the GNU one, the internationalized-domain-names girlies πŸ¦‹), and it's about one single function that fixes up your strings so they behave. strap in.


✨ NAME ✨

stringprep β€” it's an API function, and it's the main character πŸ‘‘


🌸 SYNOPSIS 🌸

#include <stringprep.h>

int stringprep(char * in, size_t maxlen, Stringprep_profile_flags flags,
               const Stringprep_profile * profile);

literally one include and one call, we love a low-effort baddie πŸŽ€


🫢 ARGUMENTS 🫢

  • char * in β€” the input/output array, and yes bestie it's holding the string you wanna prepare. in AND out, it does both, she's versatile πŸ’…
  • size_t maxlen β€” the maximum length of that input/output array. think of it as the vibe check on how much room she has 🌈
  • Stringprep_profile_flags flags β€” a Stringprep_profile_flags value, or 0. that's it. that's the options.
  • const Stringprep_profile * profile β€” a pointer to the Stringprep_profile you wanna use ✨

πŸ’œ DESCRIPTION πŸ’œ

So what does she actually DO. She prepares the input zero terminated UTF-8 string according to the stringprep profile, and then writes the result back into the input string. yes, in place. she's efficient like that πŸ”₯

heads up bestie: you must convert strings that came in from the system's locale into UTF-8 before you use this function. there's a whole other function for that, stringprep_locale_to_utf8(). don't skip that step, i'm begging πŸ™ˆ

and because the stringprep operation can expand the string, maxlen is there to tell her how large the buffer holding the string actually is. she will not read or write to characters outside that size. she respects the boundary, we stan a queen with limits πŸ‘‘

the flags are one of the Stringprep_profile_flags values, or 0. (yes, again, or 0, she's not picky πŸ“)

the profile contains the Stringprep_profile instructions to perform. and here's the fun part β€” your application can define new profiles, possibly reusing the generic stringprep tables that will always be part of the library, or you can just use one of the currently supported profiles. build your own or pick off the rack, both slay πŸ’…

Return value: she returns STRINGPREP_OK iff successful, or an error code. iff!! the mathematicians are quaking ⭐


😭 REPORTING BUGS 😭

found a bug? don't suffer in silence bestie, tell the people:


Copyright Β© 2002-2026 Simon Josefsson.

Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved.

(so like, take it, share it, remix it, just keep the receipts 🧚)


πŸ‘‘ SEE ALSO πŸ‘‘

The full documentation for libidn is maintained as a Texinfo manual. If the info and libidn programs are properly installed at your site, the command

info libidn

should give you access to the complete manual. As an alternative you may obtain the manual from:

https://www.gnu.org/software/libidn/manual/

okay that's the whole page, you ate it, no crumbs πŸ’–βœ¨ this was libidn version 1.44, stringprep(3), and she's been serving since way back. go forth and prepare your strings responsibly, bestie πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from