[getdns-users] The requirement that domain names to the API must be "ASCII-based"

Willem Toorop willem at nlnetlabs.nl
Mon Apr 24 08:34:43 UTC 2023


Op 22-04-2023 om 19:32 schreef John Scott via Users:
> Hi,
> 
> I'm writing an application using getdns, and think that the requirement that domain names passed to these functions must be "ASCII-based" poses more questions than it answers. In particular, there are lots of "ASCII-based" character encodings, some of which are different and incompatible, and it is unspecified what character encoding is actually expected. Note that not all systems use ASCII for the C language basic execution character set.
> 
> What character encoding is getdns actually supposed to expect? In other words, when passing domain name strings to getdns, what character encoding should I make sure the strings are in? What I would like to hear is that they use the same encoding as is prescribed by the locale; on POSIX systems this can be given by nl_langinfo(CODESET).

Hi John,

The functions are expecting ASCII encoding following the rules for IDNA 
2008 described in RFC 5890-5892. getdns has a function to convert from 
UTF-8 to than encoding (see: 
https://getdnsapi.net/documentation/spec/#7-more-helper-functions ), but 
it is using idn2_lookup_u8() under the hood form libidn2 (see: 
https://www.gnu.org/software/libidn/libidn2/reference/libidn2-idn2.h.html#idn2-lookup-u8 
).

To convert from whatever is prescribed by the locale, you should be 
using the idn2_lookup_ul() function from libidn2. (see: 
https://www.gnu.org/software/libidn/libidn2/reference/libidn2-idn2.h.html#idn2-lookup-ul 
)

Regards,

-- Willem

> 
> Thanks
> 
> 
> _______________________________________________
> Users mailing list
> Users at lists.getdnsapi.net
> https://lists.getdnsapi.net/mailman/listinfo/users


More information about the Users mailing list