idn_comparenames(3)
π NAME π
Bestie, welcome to the idn_comparenames(3) page from the Library Functions Manual! The NAME line is serving: idn_comparenames, idn_decodename2 β compare two internationzalized domain names. (Yes, that spelling is literally on the page. Keeping it iconic. πβ¨)
β¨ SYNOPSIS β¨
#include <idn/api.h>
idn_result_t
idn_comparenames(idn_action_t actions, const char *name1,
const char *name2);
idn_result_t
idn_comparenames2(idn_action_t actions1, const char *name1,
idn_action_t actions2, const char *name2);
π¦ DESCRIPTION π¦
Okay so idn_comparenames() is the main character here: it encodes the domain names name1 and name2 exactly the way idn_encodename() does, then compares them. If they're equivalent, it returns idn_success. If not, it returns idn_neq. And if something goes wrong during the encoding processes, it returns the corresponding error code β see idn_result_tostring(3) for the deets. π
idn_comparenames2() is the same vibe as idn_comparenames(), except it performs actions1 when it encodes name1, and it performs actions2 when it encodes name2, respectively. Two names, two action sets, no cap. π«Ά
On top of the action macros for idn_encodename() (e.g. IDN_UNICODECONV), these macros are available for idn_comparenames() and idn_comparenames2():
IDN_COMPARE_REGISTβ encodes a domain name with the IDNA2008 registration protocol before comparison. Currently, its value is the same asIDN_ENCODE_REGIST.IDN_COMPARE_LOOKUPβ encodes a domain name with the IDNA2008 lookup protocol before comparison. Currently, its value is the same asIDN_ENCODE_LOOKUP.
π EXAMPLES π
The program below shows an example of idn_comparenames(). Slay, let's look:
idn_result_t r;
...
r = idn_comparenames(IDN_COMPARE_LOOKUP, name1, name2);
if (r == idn_success)
fprintf(stderr, "'%s' == '%s'\n", name1, name2);
else if (r == idn_neq)
fprintf(stderr, "'%s' != '%s'\n", name1, name2);
else
fprintf(stderr, "error: %s\n", idn_result_tostring(r));
...
π SEE ALSO π
Catch you later, bestie π this idn_comparenames(3) page is from the Library Functions Manual, dated Sep 21, 2012. Periodt. π«Άβ¨
π¦ where this page comes from
- nixos 26.05: idnkit 2.3
- nixpkgs unstable: idnkit 2.3
- Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved
- Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
- Copyright (c) 2010-2012 Japan Registry Services Co., Ltd. All rights reserved."
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms