tld_check_lz(3)
π tld_check_lz β the libidn manual, but make it make sense π
okay bestie, so this is tld_check_lz(3) from libidn, and before u ask: yes it's a C function, no it's not scary, and yes i'm gonna hold ur hand through it. it's giving "vibe check but for domain name characters" fr fr π¦
β¨ NAME β¨
tld_check_lz β an API function. that's it, that's the name. she's short, she's sweet, she checks ur characters against TLD rules. periodt π
β¨ SYNOPSIS β¨
#include <tld.h>
int tld_check_lz(const char * in, size_t * errpos, const Tld_table **
overrides);
like yes the signature wraps weirdly, that's just how the manpage do. copy it exactly, don't get creative π
β¨ ARGUMENTS β¨
const char * inβ a zero-terminated string in the encoding of ur current locale, aka the thing u want processed. she's the main character of this whole operation πsize_t * errposβ this is where the position of the offending character gets dropped off for u. like a lil gift basket but it's just "here's where it went wrong" πconst Tld_table ** overridesβ aTld_tablearray of extra domain restriction structs that complement and supersede the built-in info. so like, built-in is the base fit andoverridesis the accessories that can straight up replace it π
β¨ DESCRIPTION β¨
so what does she actually DO. she tests every single character in in and asks: are u allowed by the info in overrides, or by the built-in TLD restriction data? π
the rules of engagement, no cap:
- when data for the same TLD exists both internally and in
overrides, the info inoverridestakes precedence. built-in stays in its lane π«Ά - if several entries for a specific TLD show up, the first one is used. first come first served, no drama β¨
- if
overridesisNULL, then it's just the built-in information, nothing else. simple life π - the position of the first offending character gets returned in
errpos.
β οΈ lowkey important: the error position refers to the decoded character offset, NOT the byte position in the string. so don't go counting bytes, bestie, u will be humbled π
Return value: returns the Tld_rc value TLD_SUCCESS if all characters are valid, or when tld is null. returns TLD_INVALID if a character is not allowed. and if things go generally wrong? additional error codes, as a treat π
β¨ REPORTING BUGS β¨
found a bug? not me manifesting that but ok, tell the devs:
- 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/
they're nice, they'll help, go forth π¦
β¨ 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: take it, share it, remix it, just keep the receipts bestie π«Ά)
β¨ SEE ALSO β¨
the full documentation for libidn lives in a Texinfo manual. if the info and libidn programs are properly installed at ur site, this command:
info libidn
should give u access to the complete manual. obsessed. π
as an alternative u may obtain the manual from:
https://www.gnu.org/software/libidn/manual/
okay that's the whole thing, u ate this, i'm so proud πΈ and if u ever need the receipts: this is libidn version 1.44, page tld_check_lz(3). go slay ur character validation, 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