idn2_register_ul(3)

πŸ“¦
version 2.3.8 Β· 5 versions
, in alpine 3.23, alpine 3.24, arch rolling, debian trixie, fedora 43, fedora 44, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ idn2_register_ul(3) β€” the libidn2 glow-up ✨

okay bestie, pull up a chair 🫢 this one lives in the libidn2 manual (that's the manual name, in case the header line was being mysterious), and it's literally the register-string-conversion girlie of the family. let's get into it πŸ’…


🌸 NAME 🌸

idn2_register_ul β€” an API function, no cap. that's the whole name section, she's brief and she knows it ✨


πŸŽ€ SYNOPSIS πŸŽ€

#include <idn2.h>

int idn2_register_ul(const char * ulabel, const char * alabel, char **
insertname, int flags);

πŸ’– ARGUMENTS πŸ’–

  • const char * ulabel β€” the input zero-terminated locale-encoded string, or NULL if you're not about that life. πŸ™ˆ
  • const char * alabel β€” the input zero-terminated ACE-encoded string (you know, the xn-- ones), or NULL.
  • char ** insertname β€” a newly allocated output variable holding the name you're gonna register in DNS. this is the whole point, she's the main character πŸ‘‘
  • int flags β€” optional idn2_flags to modify behaviour. little toggles, big vibes.

πŸ¦‹ DESCRIPTION πŸ¦‹

so what does she do? she performs IDNA2008 register string conversion on the domain labels ulabel and alabel, exactly as described in section 4 of RFC 5891. periodt.

heads up tho, and this is important: the input ulabel is assumed to be encoded in the locale's default coding system, and this function will transcode it to UTF-8 and NFC-normalize it for you. she's doing the work so you don't have to, icon behaviour fr fr ✨

it is recommended that you supply both ulabel and alabel for better error checking, but honestly supplying just one of them will work too. and if you're only gonna pass one? passing only alabel is better than only ulabel. see RFC 5891 section 4 for more information. iykyk πŸ’…

🌈 little history moment: after version 0.11, insertname may be NULL β€” that lets you test the conversion of src without allocating any memory. lowkey a whole mood.

⭐ RETURNS ⭐

she gives back a whole menu of possible outcomes, and you need to know them all:

  • IDN2_OK β€” returned on successful conversion. slay, she ate πŸ’–
  • IDN2_UALABEL_MISMATCH β€” returned when the given ulabel and alabel do not match each other. they're beefing 😭
  • IDN2_TOO_BIG_LABEL β€” returned when either of the input labels are too long. she's got a limit and she's not budging πŸ’€
  • IDN2_INVALID_ALABEL β€” returned when alabel does does not appear to be a proper A-label. (that double "does does" is canon, i'm just the messenger πŸ™ˆ)
  • IDN2_ICONV_FAIL β€” returned when the ulabel locale-to-UTF-8 conversion failed. the transcode said nope πŸ“
  • or, you know, another error code is returned. there's a whole extended universe of them.

πŸ› REPORTING BUGS πŸ›

found a bug? don't suffer in silence, bestie. report it to:

help-libidn@gnu.org

general guidelines for reporting bugs live at:

https://www.gnu.org/gethelp/

and the Libidn2 home page is right here:

https://www.gnu.org/software/libidn2/

Copyright Β© 2002-2025 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 go forth and share responsibly 🫢


πŸ’œ SEE ALSO πŸ’œ

the full documentation for libidn2 is maintained as a Texinfo manual. if the info and libidn2 programs are properly installed at your site, this command:

info libidn2

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

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

and that's the whole page, bestie!! this was libidn2 version 2.3.8 doing the absolute most πŸ’…βœ¨ go forth, convert your labels, and remember: supply both ulabel and alabel for better error checking. mwah πŸŽ€πŸ¦‹πŸ’–

πŸ“¦ where this page comes from