idna_to_ascii_4i(3)
π idna_to_ascii_4i β a libidn moment π
okay bestie, sit down, hydrate, because we're about to talk about idna_to_ascii_4i(3) from libidn. it's the API function that takes your cute little Unicode domain label and turns it into plain ASCII. it's giving translator, it's giving glow-up, it's giving IDN. let's GO π¦
β¨ NAME β¨
idna_to_ascii_4i β literally just an API function, no cap π
β¨ SYNOPSIS β¨
#include <idna.h>
int idna_to_ascii_4i(const uint32_t * in, size_t inlen, char * out, int
flags);
yes the line break in the middle of flags is real, we don't make the rules, we just copy them exactly π
β¨ ARGUMENTS β¨
const uint32_t * inβ the input array, and it's full of Unicode code points. that's the whole vibe. πΈsize_t inlenβ how long that input array of Unicode code points is. count them, bestie.char * outβ the output, a zero-terminated string. IMPORTANT: it must have room for at least 63 characters plus the terminating zero. that is not a suggestion, that is a boundary, and you will respect her πint flagsβ anIdna_flagsvalue. for exampleIDNA_ALLOW_UNASSIGNEDorIDNA_USE_STD3_ASCII_RULES. pick your fighter β¨
β¨ DESCRIPTION β¨
so the ToASCII operation takes a sequence of Unicode code points that make up one domain label and transforms it into a sequence of code points in the ASCII range (0..7F). and if ToASCII succeeds? the original sequence and the resulting sequence are equivalent labels. slay. β¨
okay but listen: ToASCII can fail. and not in a cute way. π
It is important to note that the ToASCII operation can fail. ToASCII fails if any step of it fails. If any step of the ToASCII operation fails on any label in a domain name, that domain name MUST NOT be used as an internationalized domain name. the way you deal with that failure is application-specific, so that's on you, babe. (also yes, the original says "deadling" β typo and all, we're preserving the lore π«Ά)
The inputs to ToASCII are a sequence of code points, the AllowUnassigned flag, and the UseSTD3ASCIIRules flag. The output of ToASCII is either a sequence of ASCII code points or a failure condition. that's it. two outcomes. iconic.
ToASCII never alters a sequence of code points that are all in the ASCII range to begin with (although it could fail β rude). And applying the ToASCII operation multiple times has exactly the same effect as applying it just once. idempotent queen π
Return value: Returns 0 on success, or an Idna_rc error code. zero is the good one. anything else? read the room. π
π REPORTING BUGS π
found a bug? don't suffer in silence, tell the people:
- Report bugs to
<help-libidn@gnu.org>. - General guidelines for reporting bugs:
https://www.gnu.org/gethelp/ - GNU Libidn home page:
https://www.gnu.org/software/libidn/
π COPYRIGHT π
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.
(translation: share it, remix it, just keep the receipts. free of charge, free of drama π)
π 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, the command
info libidn
should give you access to the complete manual. As an alternative you may obtain the manual from:
https://www.gnu.org/software/libidn/manual/
iykyk π
and that's the whole page, bestie. this one's from libidn, version 1.44, manual section 3, and we are obsessed. go forth and ASCII-fy responsibly ππβ¨π¦
π¦ where this page comes from
- arch rolling: libidn 1.44-1 Β· GPL3 AND LGPL
- epel 10: libidn-devel 1.44-1.el10_3 Β· (LGPL-3.0-or-later OR GPL-2.0-or-later) AND GPL-3.0-or-later AND GFDL-1.3-or-later
- fedora 43: libidn-devel 1.44-1.fc43 Β· (LGPL-3.0-or-later OR GPL-2.0-or-later) AND GPL-3.0-or-later AND GFDL-1.3-or-later
- fedora 43: libidn-devel 1.44-1.fc43 Β· (LGPL-3.0-or-later OR GPL-2.0-or-later) AND GPL-3.0-or-later AND GFDL-1.3-or-later
- fedora 44: libidn-devel 1.44-1.fc44 Β· (LGPL-3.0-or-later OR GPL-2.0-or-later) AND GPL-3.0-or-later AND GFDL-1.3-or-later
- fedora 44: libidn-devel 1.44-1.fc44 Β· (LGPL-3.0-or-later OR GPL-2.0-or-later) AND GPL-3.0-or-later AND GFDL-1.3-or-later
- ubuntu stonking: libidn-dev 1.44-1 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms