💾 Archived View for rawtext.club › ~sloum › geminilist › 006147.gmi captured on 2023-11-14 at 09:34:47. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-11-30)

-=-=-=-=-=-=-

<-- back to the mailing list

[spec] C program to resolve UTF-8 IDNs

Scot gmi1 at scotdoyle.com

Thu Mar 18 02:58:47 GMT 2021

- - - - - - - - - - - - - - - - - - - 

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 mighthave helped.

And thanks for posting the corrected code. I think it's missing thefirst 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-ws2tcpip-getaddrinfo
[4] https://devstreaming-cdn.apple.com/videos/wwdc/2016/714urluxe140lardrb7/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>
...