idn_comparenames(3)

πŸ“¦ version 2.3, in nixos 26.05, nixpkgs unstable

πŸ’– 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 as IDN_ENCODE_REGIST.
  • IDN_COMPARE_LOOKUP β€” encodes a domain name with the IDNA2008 lookup protocol before comparison. Currently, its value is the same as IDN_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
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms