idn2_to_ascii_8z(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_8z(3) β€” libidn2 ✨

okay bestie, pull up a chair because today we're talking about idn2_to_ascii_8z, one of the cutest little API functions in the whole libidn2 manual πŸ’– it lives in section 3 (that's the library-functions section, iykyk) and it is literally here to turn your pretty Unicode domain name into boring-but-necessary ASCII. the way that internationalization works?? iconic. periodt.


🌸 NAME 🌸

idn2_to_ascii_8z β€” it's an API function, bestie. that's the whole vibe. ✨


πŸŽ€ SYNOPSIS πŸŽ€

#include <idn2.h>

int idn2_to_ascii_8z(const char * input, char ** output, int flags);

yes she's a three-argument girlie and yes she returns an int. no cap. πŸ’…


πŸ¦‹ ARGUMENTS πŸ¦‹

  • const char * input β€” this is your input, bb. it's a zero terminated input UTF-8 string. so like, null-terminated, UTF-8, the whole deal. don't come at her with anything else πŸ™ˆ
  • char ** output β€” a pointer to a newly allocated output string. notice the double star?? that's because she's gonna hand you back a fresh pointer. main character energy tbh πŸ‘‘
  • int flags β€” optional idn2_flags to modify behaviour. optional!! as in you can pass stuff here if you wanna switch things up 🌈

πŸ’œ DESCRIPTION πŸ’œ

so here's the tea β˜• this function converts a UTF-8 domain name to an ASCII string using the IDNA2008 rules. that's the whole point of her existence and she ate.

your domain name can contain several labels, separated by dots. so like δΎ‹γˆ.γƒ†γ‚Ήγƒˆ vibes β€” multiple labels, dots in between, no problemo πŸ“

⚠️ important bestie: the output buffer must be deallocated by the caller. that means you free it. she allocates, you clean up. that's the deal, don't leave her hanging 😭

now, the default behavior β€” and this is the part everyone asks about β€” is that when flags are zero, she applies the IDNA2008 rules without the TR46 amendments. no TR46, no amendments, just pure IDNA2008.

but here's the thing 🫢 since TR46 non-transitional processing is nowadays ubiquitous, if you're unsure (and let's be honest, we're all unsure sometimes), it is recommended to call this function with the IDN2_NONTRANSITIONAL flag and the IDN2_NFC_INPUT flag, so you get compatibility with other software. two flags, one slay. do it for the interoperability πŸ’…βœ¨

Return value: returns IDN2_OK on success, or an error code. that's it. that's the return value. if you get IDN2_OK you're winning, anything else means something went sideways 🌸


⭐ SINCE ⭐

2.0.0 β€” she's been around since version 2.0.0, a true veteran of the game. respect the elders πŸŽ€


πŸ’€ REPORTING BUGS πŸ’€

found a bug?? okay don't panic, here's what you do:

  • Report bugs to <help-libidn@gnu.org> β€” that's the email, copy it exactly bestie, no typos πŸ“§
  • General guidelines for reporting bugs live at: https://www.gnu.org/gethelp/ β€” read these first so your bug report is chef's kiss πŸ”₯
  • Libidn2 home page: https://www.gnu.org/software/libidn2/ β€” that's the homepage, go say hi 🏠

Copyright Β© 2002-2025 Simon Josefsson. πŸ’–

and the licensing tea: copying and distribution of this file, with or without modification, are permitted in any medium without royalty β€” provided that the copyright notice and this notice are preserved. so like, go off, remix it, print it on a tote bag, whatever, just keep the notice intact. that's the rule πŸ“œβœ¨


🌈 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. bestie, that's the whole manual, right there, in your terminal 🫢

as an alternative you may obtain the manual from:

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

iykyk β€” bookmark it, it's useful πŸ’…


and that's the page!! this was libidn2 version 2.3.8, from the idn2_to_ascii_8z(3) manual page β€” thanks for reading all the way to the end bestie, you're literally the best πŸŽ€πŸ’–βœ¨ mwah! πŸ¦‹

πŸ“¦ where this page comes from