gnutls_idna_map(3)

πŸ’– gnutls_idna_map(3) πŸ’–

okay bestie so we're in the gnutls manual section and this one is literally about turning your cute lil' UTF-8 domain name into its IDNA glow-up. let's get into it ✨


✨ NAME ✨

gnutls_idna_map β€” it's an API function and yes it's giving main character energy πŸŽ€


🌸 SYNOPSIS 🌸

#include <gnutls/gnutls.h>

int gnutls_idna_map(const char * input, unsigned ilen, gnutls_datum_t *
out, unsigned flags);

like. she's a function. she takes four things. she returns an int. no cap πŸ’…


πŸ¦‹ ARGUMENTS πŸ¦‹

  • const char * input β€” this is your UTF-8 formatted domain name, bestie. the whole point. the moment. πŸ‘‘
  • unsigned ilen β€” the length of the string you just handed over. yes you have to tell her. she's not psychic 😭
  • gnutls_datum_t * out β€” where the result goes! it's a null-terminated allocated string, so it's yours to keep (and yours to free, iykyk) 🫢
  • unsigned flags β€” should be zero. that's it. that's the whole instruction. zero. 🌈

πŸ’œ DESCRIPTION πŸ’œ

so the tea is: this function converts the UTF-8 domain name you gave it into its IDNA mapping, and drops it in an allocated variable for you. cute, right? πŸŽ€

⚠️ but bestie, listen β€” depending on the flags the gnutls library you're using was compiled with, the output of this function may vary. i.e., it may be IDNA2008, or it may be IDNA2003. the vibe check is not guaranteed consistent across builds, and that's just the reality we live in 😭

to force IDNA2008, you specify the flag GNUTLS_IDNA_FORCE_2008. slay. do that if you need to be sure ✨

and in the case where GnuTLS is not compiled with the necessary dependencies? you'll get GNUTLS_E_UNIMPLEMENTED_FEATURE back, which is her way of saying "gnutls is unable to perform the requested conversion." she's not being shady, she just literally cannot πŸ’€

also note (fr fr): this function will return an empty string if an empty string is provided as input. empty in, empty out. iconic behavior honestly 🌸


🌟 RETURNS 🌟

  • GNUTLS_E_INVALID_UTF8_STRING β€” for invalid UTF-8 data πŸ™ˆ
  • 0 β€” on success πŸ‘‘

⭐ SINCE ⭐

3.5.8 β€” she's been here a minute, a real one πŸ’–


😀 REPORTING BUGS 😀

found a bug? don't just subtweet it, tell the devs:


Copyright Β© 2001-2023 Free Software Foundation, Inc., and others.

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. periodt. πŸ’…


🌈 SEE ALSO 🌈

The full documentation for gnutls is maintained as a Texinfo manual. If the /usr/share/doc/gnutls/ directory does not contain the HTML form, visit

https://www.gnutls.org/manual/

and that's the whole page bestie!! this was gnutls_idna_map(3) from the gnutls manual, version 3.8.13, dated 3.8.13 β€” thanks for reading, ily, go map some domain names πŸ«Άβœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from