stringprep_4i(3)

πŸ’– stringprep_4i(3) β€” the libidn glow-up page πŸ’–

okay bestie, so this is stringprep_4i, a lil API function living in libidn (that's the manual we're in, mwah). It's giving "i prepare your Unicode string for you" and honestly? iconic.


✨ SYNOPSIS ✨

#include <stringprep.h>

int stringprep_4i(uint32_t * ucs4, size_t * len, size_t maxucs4len,
Stringprep_profile_flags flags, const Stringprep_profile * profile);

🫢 ARGUMENTS 🫢

  • uint32_t * ucs4 β€” the input/output array holding the string you wanna prepare. It goes in messy, it comes out ready. main character behavior fr.
  • size_t * len β€” on input, this is the length of the input array, counted in Unicode code points. On exit, it's the length of the output array, also in Unicode code points. she changes, she grows, she evolves πŸ’…
  • size_t maxucs4len β€” the max length of the input/output array. the ceiling. the limit. respect it.
  • Stringprep_profile_flags flags β€” a Stringprep_profile_flags value, or 0. that's it, that's the whole vibe.
  • const Stringprep_profile * profile β€” a pointer to the Stringprep_profile you want to use. pick your fighter πŸŽ€

🌸 DESCRIPTION 🌸

Prepare the input UCS-4 string according to the stringprep profile, and write the result right back into that same input string. in-place glow-up, no cap ✨

The input does not have to be zero terminated (ucs4 [ len ] = 0). And the output will not be zero terminated either β€” unless ucs4 [ len ] = 0, obviously. So if your input is zero terminated, or if you want your output to be, go peek at stringprep_4zi() instead, bestie. that one's for you πŸ¦‹

Since the stringprep operation can expand the string, maxucs4len is there to tell everyone how big the buffer holding the string actually is. This function will not read or write to code points outside that size. boundaries!! we love them!! 🚧

The flags are one of the Stringprep_profile_flags values, or 0.

The profile contains the Stringprep_profile instructions that get performed. Your application can define brand new profiles β€” possibly reusing the generic stringprep tables that will always be part of the library, periodt β€” or just use one of the currently supported profiles. build your own or borrow someone's, both are valid 🧚

Return value: returns STRINGPREP_OK iff successful, or a Stringprep_rc error code. if it's not that, something's up 😭


🌈 DESCRIPTION 🌈 (yes, again, she said it twice and she meant it twice)

Prepare the input UCS-4 string according to the stringprep profile, and write the result right back into that same input string. (in case you scrolled past the first one, i got you πŸ’œ)

The input does not have to be zero terminated (ucs4 [ len ] = 0). And the output will not be zero terminated either β€” unless ucs4 [ len ] = 0. So if your input is zero terminated, or if you want your output to be, see stringprep_4zi() instead.

Since the stringprep operation can expand the string, maxucs4len indicates how large the buffer holding the string is. This function will not read or write to code points outside that size.

The flags are one of Stringprep_profile_flags values, or 0.

The profile contains the Stringprep_profile instructions to perform. Your application can define new profiles, possibly reusing the generic stringprep tables that always will be part of the library, or use one of the currently supported profiles.

Return value: Returns STRINGPREP_OK iff successful, or an Stringprep_rc error code.


😭 REPORTING BUGS 😭

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

fr fr, if something's broken, say something. the maintainers wanna know 🫢

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.

like, copy it, remix it, share it with the group chat β€” just keep the notice, okay? that's the whole deal πŸ’–


πŸ¦‹ 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, this command:

info libidn

should give you access to the complete manual. And if that's not hitting, you can alternatively obtain the manual from:

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

and that's the tea, bestie πŸ’… this whole page came to you from libidn version 1.44 β€” go forth, prepare those strings, and stay zero-terminated (or don't, stringprep_4zi() has your back) βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from