Re: [spec] C program to resolve UTF-8 IDNs
- 🗣️ From: Scot (gmi1 (a) scotdoyle.com)
- 📅 Sent: 2021-03-18 02:58
- 📧 Message 3 of 3
On 3/17/21 9:13 PM, Sean Conner wrote: > It was thus said that the Great Scot once stated: >> Hi Sean, > Hi Scot! > >> I think you were wondering whether it's possible to resolve UTF-8 >> IDNs with a C or Lua program. This Linux C program [7] will do so >> via glibc's getaddrinfo(). For platforms without glibc such as the >> BSDs, ports of the libidn library [1] are available. >> >> ... >> >> Thoughts? > Thank you *so* much for the sample code, and providing much needed > background information about this. This will make the final decision on IRI > support a bit easier to make. I was not aware of the GNU-specific AI_IDN > flag to getaddrinfo() (and I wish it was standard actually), and yes, it > does work on systems that have it (Linux). > > Just one thing though---you might want to be careful when pasting code > into email---the code below contained non-breaking spaces that my C compiler > (gcc) did not like. It's an easy fix, so this is mostly an FYI getting > weird errors when compiling the code below. > > Again, thank you for your message. I appreciate the work you are doing and am glad that this might have helped. And thanks for posting the corrected code. I think it's missing the first line, which is necessary on my system: #define _GNU_SOURCE > -spc > >> [1] https://www.gnu.org/software/libidn/ >> [2] https://docs.microsoft.com/en-us/windows/win32/api/winnls/nf-winnls-idntoascii >> [3] https://docs.microsoft.com/en-us/windows/win32/api/ws2tcpip/nf-ws2tc pip-getaddrinfo >> [4] https://devstreaming-cdn.apple.com/videos/wwdc/2016/714urluxe140lard rb7/714/714_networking_for_the_modern_internet.pdf?dl=1 >> [5] https://developer.android.com/reference/kotlin/java/net/IDN >> [6] https://developer.android.com/reference/android/icu/text/IDNA >> [7] Public domain example C program to resolve UTF-8 IDNs > P.S. Here's the code with the non-breaking spaces removed. > > #include <locale.h> > #include <netdb.h> > #include <stdio.h> > #include <string.h> > ... >
---
Previous in thread (2 of 3): 🗣️ Sean Conner (sean (a) conman.org)