punycode_decode(3)
β¨ punycode_decode β the libidn glow-up π
okay bestie, welcome to the punycode_decode(3) page from the libidn manual. yes it's an API function, yes it's gonna be fun, no cap. π¦
πΈ NAME πΈ
punycode_decode β an API function. that's it, that's the name, slay. π
β¨ SYNOPSIS β¨
like, here's how you summon it:
#include <punycode.h>
int punycode_decode(size_t input_length, const char [] input, size_t *
output_length, punycode_uint [] output, unsigned char [] case_flags);
she returns an int, she takes five whole things, main character energy fr fr. π
π ARGUMENTS π
okay so these are the five besties you gotta hand over. no skipping, the way that each one matters is genuinely iconic.
size_t input_lengthβ the number of ASCII code points chillin' in theinputarray. that's it. just the count. πconst char [] inputβ an array of ASCII code points, and we're talking0..7Frange only. keep it ASCII, bestie. πsize_t * output_lengthβ okay so this one is a two-way street and it's lowkey the most important. you pass IN the max number of code points you can receive into theoutputarray β and that same number is also the max number of flags you can receive into thecase_flagsarray, ifcase_flagsisn't aNULLpointer. then, on a successful return, it'll hold the number of code points actually output (which is also the number of flags actually output, ifcase_flagsisn't a null pointer). and here's the cute part: the decoder will never need to output more code points than the number of ASCII code points in the input, because of the way the encoding is defined. also the number of code points output cannot exceed the maximum possible value of apunycode_uint, even if theoutput_lengthyou handed over is bigger than that. so like, chill, it's capped. π«Άpunycode_uint [] outputβ an array of code points, same vibe as the input argument ofpunycode_encode()(see above, go look, i'll wait π).unsigned char [] case_flagsβ either aNULLpointer (if you, the caller, don't need the flags β valid, we respect it) or an array of boolean values running parallel to theoutputarray. nonzero (true, flagged) is a lil hint that the corresponding Unicode character should be forced to uppercase by the caller, if possible. zero (false, unflagged) is a hint to force it to lowercase, if possible. and the ASCII code points (0..7F) are already output in the proper case, but their flags get set appropriately anyway so that applying the flags would be harmless. thoughtful queen behavior. π
π DESCRIPTION π
so what does she actually DO? she converts Punycode to a sequence of code points (which we're presuming are Unicode code points). that's the whole job. periodt. β¨
Return value: the return value can be any of the Punycode_status values defined above. and listen carefully bestie β if it's not PUNYCODE_SUCCESS, then output_length, output, and case_flags might contain garbage. like actual trash. don't read them. don't trust them. don't look at them. π
π REPORTING BUGS π
found a bug? not the vibe, but we wanna know:
- 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. (iconic of them honestly, we love a permissive license π«Ά)
π 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/
go read it, iykyk. π
and that's the whole page bestie!! this was libidn version 1.44, page punycode_decode(3) β ty for coming to my ted talk, go decode some punycode, mwah ππβ¨
π¦ 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