idn2_to_ascii_4z(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_to_ascii_4z(3) πŸ’–

okay bestie, so this page is straight out of libidn2's manual β€” section 3, the library-functions zone β€” and it's all about one very specific lil function. let's get into it 🫢


✨ NAME ✨

idn2_to_ascii_4z β€” it's an API function, no cap, that's literally its whole job description πŸ’…


🌸 SYNOPSIS 🌸

#include <idn2.h>

int idn2_to_ascii_4z(const uint32_t * input, char ** output, int flags);

that's the whole vibe. copy it exactly, don't freestyle it πŸ™ˆ


πŸŽ€ ARGUMENTS πŸŽ€

  • const uint32_t * input β€” a zero terminated input Unicode (UCS-4) string. so like, UCS-4, four bytes per char, and it stops when it hits a zero. iconic behavior honestly πŸ’œ
  • char ** output β€” a pointer to a newly allocated zero-terminated output string. note the newly allocated part β€” that's gonna matter, keep reading πŸ‘‘
  • int flags β€” optional idn2_flags to modify behaviour. optional bestie, but lowkey powerful 🌈

πŸ¦‹ DESCRIPTION πŸ¦‹

so what does it actually DO? it converts a UCS-4 domain name into an ASCII string, using the IDNA2008 rules. periodt.

the domain name can have several labels in it β€” they're separated by dots. you know, like regular domain names do. nothing wild there.

IMPORTANT SIS: the output buffer must be deallocated by the caller. the function allocates it, you free it. it's giving "you break it, you buy it" but for memory. do NOT forget this one 😭

now, the default behavior β€” aka when flags are zero β€” is to apply the IDNA2008 rules without the TR46 amendments. but here's the tea: since TR46 non-transitional processing is basically everywhere these days (ubiquitous, fr fr), when you're unsure, the recommended move is to call this function with the IDN2_NONTRANSITIONAL flag and the IDN2_NFC_INPUT flag, so you play nice with other software 🫢

Return value: returns IDN2_OK on success, or an error code. that's it, that's the whole deal ✨


⭐ SINCE ⭐

2.0.0 β€” been here since 2.0.0, a true veteran πŸ‘‘


πŸ’€ REPORTING BUGS πŸ’€

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

they wanna hear from you, bestie, that's the whole point πŸŽ€


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 like, go off, share it, remix it β€” just keep the receipts πŸ’…


🌈 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. it's giving "the extended cut" πŸ“

as an alternative, you may obtain the manual from:

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

and that's the page!! this was libidn2 2.3.8, the idn2_to_ascii_4z(3) manual page, dropping all this knowledge πŸ’– mwah, go convert some domain names, you've got this 🧚✨

πŸ“¦ where this page comes from